wc product

Solutions on MaxInterview for wc product by the best coders in the world

showing results for - "wc product"
Greta
09 Sep 2017
1// Get the instance of the WC_Product Object
2$product = wc_get_product( $product_id);
3
4// Using `WC_Product` methods examples to get specific related data values:
5
6$product_type  = $product->get_type(); // product Type
7$product_id    = $product->get_id(); // product ID
8$product_name  = $product->get_name(); // product name
9$product_sku   = $product->get_sku(); // product SKU
10$product_price = $product->get_price(); // product price
11
12// And so on…
13
14// The raw display of the object protected data (Just for testing)
15echo '<pre>'; print_r( $product ); echo '</pre>';