Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce simple or variable product
?php
$product = new WC_Product( get_the_ID() ); // in function.php maybe...
if( $product->is_type( 'simple' ) ){
// a simple product
} elseif( $product->is_type( 'variable' ) ){
// a variable product
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.