Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Cart Item Discount Percent Gross Values #2464

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@domain @cart
Feature: Adding a new cart rule
In order to give the customer discounts
based on the cart, we add a new rule

Background:
Given the site operates on a store in "Austria" with gross values
And the site has a currency "Euro" with iso "EUR"
And I am in country "Austria"
And the site has a tax rate "AT" with "20%" rate
And the site has a tax rule group "AT"
And the tax rule group has a tax rule for country "Austria" with tax rate "AT"
And the site has a product "Shoe" priced at 10000
And the product has the tax rule group "AT"
And I add the product "Shoe" to my cart

Scenario: Add a new discount rule with 20 percent discount for all products
Given adding a cart price rule named "discount"
And the cart rule is active
And the cart rule is a voucher rule with code "asdf"
And the cart rule has a cart-item-action action
And the cart item action has a action discount-percent with 10% discount
And I apply the voucher code "asdf" to my cart
Then the cart discount should be "-1000" including tax
Then the cart total should be "9000" including tax

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@domain @cart
Feature: Adding a new cart rule
In order to give the customer discounts
based on the cart, we add a new rule

Background:
Given the site operates on a store in "Austria"
And the site has a currency "Euro" with iso "EUR"
And I am in country "Austria"
And the site has a tax rate "AT" with "20%" rate
And the site has a tax rule group "AT"
And the tax rule group has a tax rule for country "Austria" with tax rate "AT"
And the site has a product "Shoe" priced at 10000
And the product has the tax rule group "AT"
And I add the product "Shoe" to my cart

Scenario: Add a new discount rule with 20 percent discount for all products
Given adding a cart price rule named "discount"
And the cart rule is active
And the cart rule is a voucher rule with code "asdf"
And the cart rule has a cart-item-action action
And the cart item action has a action discount-percent with 10% discount
And I apply the voucher code "asdf" to my cart
Then the cart discount should be "-1200" including tax
Then the cart total should be "10800" including tax

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function applyRule(
*/
$store = $orderItem->getOrder()->getStore();

$discount = $this->getDiscount($orderItem, $configuration);
$discount = $this->getDiscount($orderItem, $configuration, $store->getUseGrossPrice());

if ($discount <= 0) {
return false;
Expand Down