/** * Returns the price in html format. * * @access public * @param string $price (default: '') * @return string */ public function get_price_html($price = '') { $price = parent::get_price_html($price); if (!isset($this->subscription_period) || !isset($this->subscription_period_interval) || !isset($this->max_variation_period) || !isset($this->max_variation_period_interval)) { $this->variable_product_sync(); } // Only create the subscription price string when a price has been set if ($this->subscription_price !== '' || $this->subscription_sign_up_fee !== '') { $price = ''; if ($this->is_on_sale() && isset($this->min_variation_price) && $this->min_variation_regular_price !== $this->get_price()) { if (!$this->min_variation_price || $this->min_variation_price !== $this->max_variation_price) { $price .= $this->get_price_html_from_text(); } $price .= $this->get_price_html_from_to($this->get_variation_price('min', true), $this->get_variation_price('max', true)); } else { if ($this->min_variation_price !== $this->max_variation_price) { $price .= $this->get_price_html_from_text(); } $price .= wc_price($this->get_variation_price('min', true)); } // Make sure the price contains "From:" when billing schedule differs between variations if (false === strpos($price, $this->get_price_html_from_text())) { if ($this->subscription_period !== $this->max_variation_period) { $price = $this->get_price_html_from_text() . $price; } elseif ($this->subscription_period_interval !== $this->max_variation_period_interval) { $price = $this->get_price_html_from_text() . $price; } } $price .= $this->get_price_suffix(); $price = WC_Subscriptions_Product::get_price_html($price, $this); } return apply_filters('woocommerce_variable_subscription_price_html', $price, $this); }
/** * Returns the price in html format. * * @access public * @param string $price (default: '') * @return string */ public function get_price_html($price = '') { $price = parent::get_price_html($price); if (!isset($this->subscription_period) || !isset($this->subscription_period_interval) || !isset($this->max_variation_period) || !isset($this->max_variation_period_interval)) { $this->variable_product_sync(); } // Only create the subscription price string when a price has been set if ($this->subscription_price !== '' || $this->subscription_sign_up_fee !== '') { $price = ''; if ($this->is_on_sale() && isset($this->min_variation_price) && $this->min_variation_regular_price !== $this->get_price()) { if (!$this->min_variation_price || $this->min_variation_price !== $this->max_variation_price) { $price .= $this->get_price_html_from_text(); } $variation_id = get_post_meta($this->id, '_min_price_variation_id', true); $variation = $this->get_child($variation_id); $tax_display_mode = get_option('woocommerce_tax_display_shop'); $sale_price = $tax_display_mode == 'incl' ? $variation->get_price_including_tax(1, get_post_meta($variation_id, '_sale_price', true)) : $variation->get_price_excluding_tax(1, get_post_meta($variation_id, '_sale_price', true)); $regular_price = $tax_display_mode == 'incl' ? $variation->get_price_including_tax(1, get_post_meta($variation_id, '_regular_price', true)) : $variation->get_price_excluding_tax(1, get_post_meta($variation_id, '_regular_price', true)); $price .= $this->get_price_html_from_to($regular_price, $sale_price); } else { if ($this->min_variation_price !== $this->max_variation_price) { $price .= $this->get_price_html_from_text(); } $price .= wc_price($this->get_variation_price('min', true)); } // Make sure the price contains "From:" when billing schedule differs between variations if (false === strpos($price, $this->get_price_html_from_text())) { if ($this->subscription_period !== $this->max_variation_period) { $price = $this->get_price_html_from_text() . $price; } elseif ($this->subscription_period_interval !== $this->max_variation_period_interval) { $price = $this->get_price_html_from_text() . $price; } } $price .= $this->get_price_suffix(); $price = WC_Subscriptions_Product::get_price_string($this, array('price' => $price)); } return apply_filters('woocommerce_variable_subscription_price_html', $price, $this); }
/** * Returns the price in html format. * * @access public * @param string $price (default: '') * @return string */ public function get_price_html($price = '') { $price = parent::get_price_html($price); if (!isset($this->subscription_period) || !isset($this->subscription_period_interval) || !isset($this->max_variation_period) || !isset($this->max_variation_period_interval)) { $this->variable_product_sync(); } // Only create the subscription price string when a price has been set if (($this->subscription_price > 0 || $this->subscription_sign_up_fee > 0) && ($this->subscription_price !== '' || $this->subscription_sign_up_fee !== '')) { // Make sure the price contains "From:" when billing schedule differs between variations if (false === strpos($price, $this->get_price_html_from_text())) { if ($this->subscription_period !== $this->max_variation_period) { $price = $this->get_price_html_from_text() . $price; } elseif ($this->subscription_period_interval !== $this->max_variation_period_interval) { $price = $this->get_price_html_from_text() . $price; } } $price = WC_Subscriptions_Product::get_price_html($price, $this); } return apply_filters('woocommerce_variable_subscription_price_html', $price, $this); }