Solution for : To get SKU in product single page in woocommerce
Below is code/function To get SKU in product single page in woocommerce
get_sku()
is a method of the WC_Product class, so you need to have a product on which to call it, like this:
echo $product->get_sku();
This should work if you are inside the WooCommerce product loop, and is what is used in the WooCommerce template files. If you don't already have a reference to the product object, you may need to add the following line at the top of the file in order to access it:
global $product;
No comments:
Post a Comment