Skip to content

[5.x]: Discount "conditional rules" vs "Order Condition Formula" with coupon code #3935

@ragnarfrosti

Description

@ragnarfrosti

What happened?

Description

I like that we can use conditional rules on the discounts to match orders/customers; it is also a more user-friendly way for our clients to create specific discounts instead of using the "Order Condition Formula," where it is easy for the clients to mess up the twig code.

But, let´s say that we have a discount with a coupon code, "TEST-COUPON," that I only want customers that match specific conditions to be able to use.

We can achieve this in two different ways:

  1. Using "Conditional rules":

Image

  1. Using the "Order Condition Formula"

Image

If the conditions are met, both cases add the discount and the coupon code to the order.

If the conditions are not met, neither scenarios add the discount to the order, but using the "Conditional rules," the coupon code is saved to the order and not when using the "Order condition Formula".

So, even though the discount does not match the conditions of the order using the "Conditional rules," the coupon code is saved to the order. Is it possible that discounts using the conditional rules could work in the same way as discounts using the "Order condition formula" and not save the coupon code on the order if the conditions are not met?

Craft CMS version

5.6.4

Craft Commerce version

5.2.12.1

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions