PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.22
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.22
1.4.22 1.4.21 1.4.20 1.4.19 1.4.18 1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 All 185 releases
← All changes | app/Calc/CalcFactory.php +10 -6 1.3.53 → 1.4.22 View file →
@@ -53,14 +53,14 @@
53 53 * @param \Disco\App\Utility\Config $campaign Campaign.
54 54 */
55 55 public static function discount_applies_to( array $rule, Config $campaign ): string {
56 56 if (
57 - $rule['discount_type'] === 'percent'
58 - || $rule['discount_type'] === 'fixed'
59 - || $rule['discount_type'] === 'fixed_price'
57 + 'percent' === $rule['discount_type']
58 + || 'fixed' === $rule['discount_type']
59 + || 'fixed_price' === $rule['discount_type']
60 60 ) {
61 61 $applies_to = 'line_item_subtotal';
62 - } elseif ( $rule['discount_type'] === 'percent_per_product' || $rule['discount_type'] === 'fixed_per_product' ) {
62 + } elseif ( 'percent_per_product' === $rule['discount_type'] || 'fixed_per_product' === $rule['discount_type'] ) {
63 63 $applies_to = 'line_item';
64 64 } elseif ( 'Product' === $campaign->get_discount_intent() ) {
65 65 $applies_to = 'product';
66 66 } else {
@@ -100,9 +100,13 @@
100 100 * @param \WC_Cart $cart Cart.
101 101 * @return float Cart Subtotal.
102 102 */
103 103 public static function get_cart_subtotal( WC_Cart $cart ): float {
104 - // Get cart subtotal from cart if disco pro is active.
104 + /**
105 + * Get cart subtotal from cart if disco pro is active,
106 + * if disco pro is not active, get cart subtotal from meta.
107 + * It's for support Multi-currency plugin in disco pro.
108 + */
105 109 if ( Disco::is_pro() ) {
106 110 return $cart->get_subtotal();
107 111 }
108 112
@@ -125,9 +129,9 @@
125 129 */
126 130 public static function get_free_quantity( array $rule, array $item ) {
127 131 $cart_qty = $item['quantity'];
128 132
129 - if ( $rule['recursive'] === 'no' && $rule['min'] > 0 ) {
133 + if ( 'no' === $rule['recursive'] && $rule['min'] > 0 ) {
130 134 return $rule['get_quantity'];
131 135 }
132 136
133 137 return floor( $cart_qty / $rule['min'] ) * $rule['get_quantity'];