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 +5 -5 1.4.18 → 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 {
@@ -129,9 +129,9 @@
129 129 */
130 130 public static function get_free_quantity( array $rule, array $item ) {
131 131 $cart_qty = $item['quantity'];
132 132
133 - if ( $rule['recursive'] === 'no' && $rule['min'] > 0 ) {
133 + if ( 'no' === $rule['recursive'] && $rule['min'] > 0 ) {
134 134 return $rule['get_quantity'];
135 135 }
136 136
137 137 return floor( $cart_qty / $rule['min'] ) * $rule['get_quantity'];