| @@ -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']; |