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