コード例 #1
0
 public function verify_product_isvariation($prod_id)
 {
     // verify we are in woocommerce product
     if (function_exists('get_product')) {
         $product = new WC_Product_Variable($prod_id);
         // WC_Product
         if (isset($product->id) && (int) $product->id > 0) {
             if ($product->has_child()) {
                 // is product variation parent!
                 return true;
             }
         }
     }
     return false;
 }