PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.3
Tiered Pricing Table for WooCommerce v2.2.3
8.1.0 8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 All 92 releases
← All changes | src/Frontend/CatalogPriceManager.php +8 -2 2.1.1 → 2.2.3 View file →
@@ -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