On a custom Wordpress theme, I'm looking to access the product info of products created using the Woo Commerce plugin. Can global product objects be pulled from anywhere within the php files?
closed as off-topic by Mark Kaplun, Nathan Johnson, Christine Cooper♦, EAMann Mar 3 '18 at 0:09
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third party plugins and themes are off topic, they are better asked about at their developers' support routes." – Mark Kaplun, Nathan Johnson, Christine Cooper, EAMann
Yes you can - see here: https://docs.woocommerce.com/wc-apidocs/class-WC_Product.html
You'd use something like
$myproduct = new WC_Product( $product_id );
Hope that helps