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/RoleBasedPricing/RoleBasedPricingRule.php +34 -0 6.1.0 → 8.0.2 View file →
@@ -14,8 +14,10 @@
14 14 protected $minimumOrderQuantity = null;
15 15 protected $tieredPricingType = 'fixed';
16 16 protected $percentageTieredPricingRules = array();
17 17 protected $fixedTieredPricingRules = array();
18 + protected $taxStatus = '';
19 + protected $taxClass = '';
18 20
19 21 public function __construct( $productId, $role ) {
20 22 $this->productId = $productId;
21 23 $this->role = $role;
@@ -114,8 +116,24 @@
114 116 public function getTieredPricingRules(): array {
115 117 return $this->getTieredPricingType() === 'percentage' ? $this->getPercentageTieredPricingRules() : $this->getFixedTieredPricingRules();
116 118 }
117 119
120 + public function getTaxStatus(): string {
121 + return $this->taxStatus;
122 + }
123 +
124 + public function setTaxStatus( string $taxStatus ) {
125 + $this->taxStatus = $taxStatus;
126 + }
127 +
128 + public function getTaxClass(): string {
129 + return $this->taxClass;
130 + }
131 +
132 + public function setTaxClass( string $taxClass ) {
133 + $this->taxClass = $taxClass;
134 + }
135 +
118 136 public function asArray(): array {
119 137 return array(
120 138 // main
121 139 'product_id' => $this->getProductId(),
@@ -134,8 +152,12 @@
134 152 'fixed_rules' => $this->getFixedTieredPricingRules(),
135 153
136 154 // MOQ
137 155 'minimum' => $this->getMinimumOrderQuantity(),
156 +
157 + // Tax
158 + 'tax_status' => $this->getTaxStatus(),
159 + 'tax_class' => $this->getTaxClass(),
138 160 );
139 161 }
140 162
141 163 /**
@@ -164,8 +186,12 @@
164 186 'fixed_price_rules' => $this->getFixedTieredPricingRules(),
165 187
166 188 // MOQ
167 189 'tiered_price_minimum_qty' => $this->getMinimumOrderQuantity(),
190 +
191 + // Tax
192 + 'tiered_price_tax_status' => $this->getTaxStatus(),
193 + 'tiered_price_tax_class' => $this->getTaxClass(),
168 194 );
169 195
170 196 $role = $this->getRole();
171 197
@@ -193,8 +219,12 @@
193 219
194 220 // MOQ
195 221 $rule->setMinimumOrderQuantity( RoleBasedPriceManager::getProductQtyMin( $productId, $role ) );
196 222
223 + // Tax
224 + $rule->setTaxStatus( RoleBasedPriceManager::getProductTaxStatus( $productId, $role ) );
225 + $rule->setTaxClass( RoleBasedPriceManager::getProductTaxClass( $productId, $role ) );
226 +
197 227 return apply_filters( 'tiered_pricing_table/role_based/after_built_rule', $rule );
198 228 }
199 229
200 230 public static function buildFromArray( int $productId, string $role, array $data ): self {
@@ -213,8 +243,12 @@
213 243 $rule->setFixedTieredPricingRules( isset( $data['fixed_tiered_pricing_rules'] ) ? (array) $data['fixed_tiered_pricing_rules'] : array() );
214 244
215 245 // MOQ
216 246 $rule->setMinimumOrderQuantity( isset( $data['minimum_order_quantity'] ) ? (int) $data['minimum_order_quantity'] : null );
247 +
248 + // Tax
249 + $rule->setTaxStatus( isset( $data['tax_status'] ) ? (string) $data['tax_status'] : '' );
250 + $rule->setTaxClass( isset( $data['tax_class'] ) ? (string) $data['tax_class'] : '' );
217 251
218 252 return apply_filters( 'tiered_pricing_table/role_based/after_built_rule_from_array', $rule, $role, $data );
219 253 }
220 254 }