Steps to reproduce:

  • create a promotion, set it as not compatible with any other promotions, and create a coupon for it
  • create a draft order, apply the coupon, save
  • reopen the order edit page and attempt to save

Result: saving fails with error message on the coupon field: "The provided coupon code code is invalid".

Proposed resolution:

Method \Drupal\commerce_promotion\Entity\Promotion::applies() needs to exclude $this promotion when checking against the already saved promotions from the $order.

CommentFileSizeAuthor
#2 3392225-1.patch718 bytests.ag

Comments

ts.ag created an issue. See original summary.

ts.ag’s picture

StatusFileSize
new718 bytes
ts.ag’s picture

Status: Active » Needs review

  • jsacksick committed da3c674d on 8.x-2.x
    Issue #3392225 by ts.ag: Promotion applies() doesn't exclude $this when...

  • jsacksick committed 68ea0060 on 3.0.x
    Issue #3392225 by ts.ag: Promotion applies() doesn't exclude $this when...
jsacksick’s picture

Status: Needs review » Fixed

Committed, thanks!

jsacksick’s picture

Actually... I'm afraid this will cause the same promotion to be applicable more than once on the same order... Considering reverting this now...
Suddenly not 100% sure about your bug report, the adjustments should be cleared on order refresh right?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.