| @@ -38,9 +38,15 @@ | ||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | 41 | public function formatPrice( $priceHtml, $product ) { |
| 42 | - if ( ! is_product() ) { | |
| 42 | + | |
| 43 | + $product_id = $product->is_type('variation') ? $product->get_parent_id() : $product->get_id(); | |
| 44 | + | |
| 45 | + $formatCondition = $this->settings->get( 'tiered_price_at_product_page', | |
| 46 | + 'no' ) === 'yes' || get_queried_object_id() != $product_id; | |
| 47 | + | |
| 48 | + if ( $formatCondition ) { | |
| 43 | 49 | $displayPriceType = $this->getDisplayType(); |
| 44 | 50 | |
| 45 | 51 | if ( in_array( $product->get_type(), [ 'simple', 'variation' ] ) ) { |
| 46 | 52 | $rules = PriceManager::getPriceRules( $product->get_id() ); |
| @@ -147,9 +153,9 @@ | ||
| 147 | 153 | */ |
| 148 | 154 | protected function getLowestPrice( $rules, $product, $html = true ) { |
| 149 | 155 | if ( PriceManager::getPricingType( $product->get_id() ) === 'percentage' ) { |
| 150 | 156 | $lowest = PriceManager::getPriceByPercentDiscount( $product->get_price(), |
| 151 | - array_shift( $rules ) ); | |
| 157 | + array_pop( $rules ) ); | |
| 152 | 158 | } else { |
| 153 | 159 | $lowest = array_pop( $rules ); |
| 154 | 160 | } |
| 155 | 161 | |