Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I deleted a promotion and its coupons persisted. I created a new promotion and re-used the coupon code and received errors loading my promotion. Which lead to discovery of #2855836: Coupon codes need unique value validation constraint.
Comments
Comment #2
vasikei'll try this
Comment #3
vasikeThere is a PR about this
https://github.com/drupalcommerce/commerce/pull/658
- Similar with what we have for Product & Variations and Order & Items
- Also a post update to delete the orphaned coupons.
- Nothing on tests - not sure
This issue raises some questions:
1. Do we need a backreference field for promotion on coupons
similar with what's done at #2557477: Add line item -> order and product variation -> product backreferences
Also new methods getPromotion / getPromotionId
2. What about new method on Promotion entity:
getCoupons() / getCouponsCodes / getCouponsIds
3. ....
Comment #4
mglamanYes, I thought I made a ticket for this, I guess not.
Yes.
Want to make of those two issues?
Comment #5
vasikeThis is part of #2857560: Complete the coupon <-> promotion data model for PR
After i'll publish the new PR, i'll close the one i did previously.
Comment #6
vasikenew PR for the parent issue, it includes the fix for this.
https://github.com/drupalcommerce/commerce/pull/660
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedClosing for the parent issue.