PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
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 2.3.3 All 91 releases
← All changes | src/Addons/GlobalTieredPricing/PricingService.php +12 -8 6.1.0 → 8.0.2 View file →
@@ -2,9 +2,9 @@
2 2
3 3 namespace TierPricingTable\Addons\GlobalTieredPricing;
4 4
5 5 use TierPricingTable\PricingRule;
6 -use TierPricingTable\Settings\Sections\GeneralSection\Subsections\CartOptionsSubsection;
6 +use TierPricingTable\Addons\TieredPricingCart\CartOptionsSubsection;
7 7 class PricingService {
8 8 public function __construct() {
9 9 /**
10 10 * Main function to filter the tiered pricing rules
@@ -64,9 +64,8 @@
64 64 }
65 65
66 66 public function addFlexibleGlobalPricing( PricingRule $pricingRule, GlobalPricingRule $globalPricingRule ) : PricingRule {
67 67 $updateRegularPricing = false;
68 - $updateQuantityLimits = false;
69 68 $updateTieredPricing = false;
70 69 /**
71 70 * Regular prices
72 71 */
@@ -79,20 +78,25 @@
79 78 }
80 79 /**
81 80 * Quantity Limits
82 81 */
82 + $updateMinimum = false;
83 + $updateMixAndMatch = false;
83 84 if ( $globalPricingRule->getSettings()->getQuantityLimitsPriority() === 'prefer-role-based-product' ) {
84 - // Update only if there are no quantity limits set in the product or role-based
85 85 if ( $pricingRule->provider !== 'role-based' ) {
86 - $updateQuantityLimits = true;
86 + $updateMinimum = true;
87 + $updateMixAndMatch = true;
87 88 }
88 89 } elseif ( $globalPricingRule->getSettings()->getQuantityLimitsPriority() === 'prefer-product' ) {
89 - // Update only if there are no quantity limits set in the product
90 90 if ( empty( $pricingRule->getMinimum() ) ) {
91 - $updateQuantityLimits = true;
91 + $updateMinimum = true;
92 92 }
93 + if ( get_post_meta( $pricingRule->getProductId(), '_tiered_price_mix_and_match_minimum', true ) === '' ) {
94 + $updateMixAndMatch = true;
95 + }
93 96 } else {
94 - $updateQuantityLimits = true;
97 + $updateMinimum = true;
98 + $updateMixAndMatch = true;
95 99 }
96 100 /**
97 101 * Tiered Pricing
98 102 */
@@ -108,9 +112,9 @@
108 112 $updateTieredPricing = true;
109 113 }
110 114 if ( $updateRegularPricing ) {
111 115 }
112 - if ( $updateQuantityLimits ) {
116 + if ( $updateMinimum || $updateMixAndMatch ) {
113 117 }
114 118 if ( $updateTieredPricing ) {
115 119 $pricingRule->setRules( $globalPricingRule->getTieredPricingRules() );
116 120 $pricingRule->setType( $globalPricingRule->getTieredPricingType() );