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

Discount being incorrectly applied when adding multiple products to cart at once #797

Closed
paulgoodfield opened this issue Mar 21, 2019 · 2 comments
Labels

Comments

@paulgoodfield
Copy link

Description

If I create a discount based on a category, if a product related to this category is added to the cart at the same time as multiple other products, the discount gets applied to all items in the cart. Have just checked this on a fresh install.

Expected behaviour

When adding multiple products to cart at once, discounts only get applied to products related to discount category.

Steps to reproduce

  1. In CP go to Settings > Categories and create a new category group called Discount categories.
  2. Create a category in this group called Online discount.
  3. In Settings > Fields create a field called Discount categories.
  4. In Commerce > System Settings > Product Types > Clothing click on Product Fields tab and add the Discount categories field created in step 3.
  5. In Commerce > Products click on the A New Toga product and choose the Online discount category from the Discount categories field.
  6. Go to Commerce > Promotions > Discounts and create a new discount called Online discount. In the Conditions tab choose the Online discount category from the Categories field (this should mean this discount only gets applied to products related to this category). In the Amounts tab choose 10% off the original item price as the discount amount. Save discount.
  7. Go to front end of website and click the Add all products to cart button. The cart page shows that the 10% discount has been added to all line items. This can be confirmed by checking the active cart in the CP.

Additional info

This only seems to happen when multiple products are added to the cart at once (like using the Add all products to cart button). When added one at a time it seems to be fine. Additionally, when any other action is performed that updates the cart (like moving to next step in checkout phase, or removing line from cart) then the issue is corrected.

  • Craft version: Craft Solo 3.1.19 (also tested with Craft Pro)
  • PHP version: 7.1.27 (also tested on 7.0)
  • Database driver & version: MySQL 5.7.18
  • Plugins & versions: Craft Commerce 2.1.2
@lukeholder lukeholder added the bug label Mar 22, 2019
@paulgoodfield
Copy link
Author

@lukeholder Can you confirm that you were able to replicate this bug on your side? Need to inform our client on the reasons for this issue.

@lukeholder
Copy link
Member

This has now been fixed for the next release. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants