I need to display global $product in my custom shortcode. I am trying to create a manual layout of $product with only products with "category C".
so in my shortcode i declared
//Create display Apple function
function wpb_displayApples_shortcode() {
global $product;
echo '<pre>';
print_r($product);
echo '</pre>';
}
// register shortcode
add_shortcode('displaydisplayApples', 'wpb_displayApples_shortcode');
but my functions return blank $product
When i use $woocommerce, I get data but I can not locate my products.
How do i get all my products on my custom shortcode, to manually display control my products layout?