craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
219 stars 170 forks source link

[5.x]: Total Qty match discount not applying #3559

Closed turnstylerj closed 3 months ago

turnstylerj commented 3 months ago

What happened?

Description

We have set up a 10% discount when a customer adds 6 or more products to their cart. When this condition happens on the front end, order.storedTotalDiscount is returning 0.0 and I don't see any discount applied when looking at the active cart in the CMS.

Steps to reproduce

  1. Create a discount with the Conditions set to Match Order / Total Qty / is greater than or equals / 6
  2. Set discount Actions to Discount all line items 10% off the original item price

Expected behavior

Items are discounted when user reaches this condition in their current cart.

Actual behavior

Nothing is discounted

Craft CMS version

5.2.4.1

Craft Commerce version

5.0.11.1

PHP version

8.2.19

Operating system and version

Linux 6.5.0-15-generic

Database type and version

MySQL 8.0.33

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

CKEditor 4.1.0 Colour Swatches 5.0.0 Control Panel CSS 3.0.0 Craft Commerce 5.0.11.1 Default Dashboard 3.0.0 Element Relations 3.0.4 Field Manager 4.0.1 Guide 4.0.0-beta.1 ImageOptimize 5.0.2 Image Resizer 4.0.0 Multi Translator 2.5.2 Neo 5.0.5 No-Cache 3.0.2 PayPal Checkout for Craft Commerce 3.0.1 Redirects 5.0.2 Retcon 3.2.0 SEO 5.0.4 Servd Assets and Helpers 4.0.3 Stripe for Craft Commerce 5.0.1.1

linear[bot] commented 3 months ago

PT-1904 [5.x]: Total Qty match discount not applying

nfourtythree commented 3 months ago

Hi @turnstylerj

Thank you for your message.

I have just tried to replicate this, however, I am not able to see what you are seeing.

Below is a video showing the setup of a discount and it being used in the front end with everything working as expected.

https://github.com/craftcms/commerce/assets/266453/d9d22943-6157-4425-b2fa-37bdf7a858bd

Is it possible that you have some other conditions set that mean the discount is not matching? Are the variants set to not be promotable?

Thanks

turnstylerj commented 3 months ago

D'oh! It was totally because the variants weren't set to be promotable. Thanks for the text/example!