Use conditional logic for woocommerce variable product

Late to the party but here you go:

<?php

if( $product->is_type( 'simple' ) ){

  // a simple product

} elseif( $product->is_type( 'variable' ) ){

  // a variable product

}
// If you need a Product object for the above:
$product = new WC_Product( get_the_ID() );

Found it here: https://gist.github.com/patrickgilmour/9d4a28b4a2f0c1dcecbf and here https://wordpress.org/support/topic/condition-to-check-if-product-is-simple-or-variable.

I’m glad this question wasn’t closed 🙂

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)