コード例 #1
0
 public function is_purchasable($purchasable, $product)
 {
     if ($product->is_type(WC_Name_Your_Price_Helpers::$supported_types) && WC_Name_Your_Price_Helpers::is_nyp($product) || $product->is_type(WC_Name_Your_Price_Helpers::$supported_variable_types) && WC_Name_Your_Price_Helpers::has_nyp($product)) {
         $purchasable = true;
     }
     return $purchasable;
 }
コード例 #2
0
 public static function admin_price_html($price, $product)
 {
     if (WC_Name_Your_Price_Helpers::is_nyp($product) && !isset($product->is_filtered_price_html)) {
         $price = $product->get_price_html_from_text() . WC_Name_Your_Price_Helpers::get_price_string($product, 'minimum');
     } else {
         if (WC_Name_Your_Price_Helpers::has_nyp($product) && !isset($product->is_filtered_price_html)) {
             $price = $product->get_price_html_from_text() . WC_Name_Your_Price_Helpers::get_price_string($product, 'minimum-variation');
         }
     }
     return $price;
 }
コード例 #3
0
 /**
  * Get the min or max variation (active) price.
  *
  * @param  string $price
  * @param  string $min_or_max - min or max
  * @param  boolean  $display Whether the value is going to be displayed
  * @return string
  * @since  2.0
  */
 public function get_variation_price($price, $product, $min_or_max, $display)
 {
     if (WC_Name_Your_Price_Helpers::has_nyp($product)) {
         $price = get_post_meta($product->id, '_' . $min_or_max . '_variation_price', true);
     }
     return $price;
 }