← All changes
|
src/Addons/GlobalTieredPricing/CPT/Form/Tabs/Quantity.php
+36
-11
6.5.0
→
8.1.0
View file →
| @@ -4,36 +4,61 @@ | ||
| 4 | 4 | use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule; |
| 5 | 5 | use TierPricingTable\Forms\MinimumOrderQuantityForm; |
| 6 | 6 | |
| 7 | 7 | class Quantity extends FormTab { |
| 8 | - | |
| 8 | + | |
| 9 | 9 | public function getId(): string { |
| 10 | 10 | return 'quantity'; |
| 11 | 11 | } |
| 12 | - | |
| 12 | + | |
| 13 | 13 | public function getTitle(): string { |
| 14 | 14 | return __( 'Quantity limits', 'tier-pricing-table' ); |
| 15 | 15 | } |
| 16 | - | |
| 16 | + | |
| 17 | 17 | public function getDescription(): string { |
| 18 | 18 | return __( 'Set minimum, maximum, and quantity step limits', 'tier-pricing-table' ); |
| 19 | 19 | } |
| 20 | - | |
| 20 | + | |
| 21 | 21 | public function render( GlobalPricingRule $pricingRule ) { |
| 22 | - | |
| 22 | + | |
| 23 | 23 | $this->renderSectionTitle( __( 'Quantity Limits', 'tier-pricing-table' ), array( |
| 24 | - 'only_for_premium' => true, | |
| 25 | - 'description' => __('Applies to each product individually.', 'tier-pricing-table') | |
| 24 | + 'only_for_premium' => true, | |
| 25 | + 'description' => __( 'Applies to each product individually. If mix & match is enabled, the minimum quantity requirement will be shared across variations of a variable product.', | |
| 26 | + 'tier-pricing-table' ), | |
| 26 | 27 | ) ); |
| 27 | - | |
| 28 | + | |
| 28 | 29 | MinimumOrderQuantityForm::render( null, null, $pricingRule->getMinimum() ); |
| 29 | - | |
| 30 | + | |
| 30 | 31 | do_action( 'tiered_pricing_table/global_pricing/after_minimum_order_quantity_field', $pricingRule->getId(), |
| 31 | - $pricingRule ); | |
| 32 | + $pricingRule ); | |
| 33 | + | |
| 34 | + $this->renderSectionTitle( __( 'Variable Product Minimum Quantity', 'tier-pricing-table' ), array( | |
| 35 | + 'description' => __( 'Determine whether the minimum quantity requirement applies to each variation separately, or to the combined total of all variations in the cart.', 'tier-pricing-table' ), | |
| 36 | + ) ); | |
| 37 | + | |
| 38 | + $mixAndMatchValue = $pricingRule->getMixAndMatchMinQuantity(); | |
| 39 | + $mixAndMatchString = is_null( $mixAndMatchValue ) ? '' : ( $mixAndMatchValue ? 'yes' : 'no' ); | |
| 40 | + | |
| 41 | + woocommerce_wp_select( array( | |
| 42 | + 'id' => 'mix_and_match_minimum', | |
| 43 | + 'value' => $mixAndMatchString, | |
| 44 | + 'options' => array( | |
| 45 | + '' => __( 'Global Settings', 'tier-pricing-table' ), | |
| 46 | + 'no' => __( 'Individual variation', 'tier-pricing-table' ), | |
| 47 | + 'yes' => __( 'Variable product total (Mix & match)', 'tier-pricing-table' ), | |
| 48 | + ), | |
| 49 | + 'label' => __( 'Calculate minimum quantity by', 'tier-pricing-table' ), | |
| 50 | + ) ); | |
| 51 | + | |
| 32 | 52 | ?> |
| 53 | + <style> | |
| 54 | + #mix_and_match_minimum { | |
| 55 | + width: 75% !important; | |
| 56 | + } | |
| 57 | + </style> | |
| 33 | 58 | <?php |
| 34 | 59 | } |
| 35 | - | |
| 60 | + | |
| 36 | 61 | public function getIcon(): string { |
| 37 | 62 | return 'dashicons-database'; |
| 38 | 63 | } |
| 39 | 64 | } |