Short description of issue
Inconsistent behavior when trying to apply a discount code to a cart that already has a discount code applied.
Reproduction steps
- Create a discount with a couple of discount codes via the API.
- Apply one of the codes at checkout.
- Try to apply a different code of the same discount.
- You will see that for some codes it will “overwrite” the existing code, for some codes it will not.
Additional info
The same behavior is happening with the /discount/CODE endpoint (which seems to be depricated now?), aswell as the cart/update.js endpoint.
It also happens cross discount but it might be the intended behavior to not allow cross discount “overrides”.
When looking at the discounts in the cart after applying the initial discount code and a different code of the same discount, we can see that both have been added to the cart, where one of them is applicable.
[
{
"code": "TEST-DS7FYDI8WV",
"applicable": false
},
{
"code": "TEST-SY7A5G3J7T",
"applicable": true
}
]
Fo far so good but
- when
TEST-DS7FYDI8WVis applied first, I then enterTEST-SY7A5G3J7T, the applicable code isTEST-SY7A5G3J7T - when
TEST-SY7A5G3J7Tis applied first, I then enterTEST-DS7FYDI8WV, the applicable code isTEST-SY7A5G3J7T
This means TEST-SY7A5G3J7T always has a higher priority than TEST-DS7FYDI8WV
Is it intended that the newest code does not have priority?
What type of topic is this
Bug report