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.
You can add new coupons and reuse existing codes. This causes errors when loading a coupon by its code, as its unknown (or incorrect) which promotion that is loaded.
Comments
Comment #2
vasikelet's try it
Comment #3
vasikeand there is a PR for this
https://github.com/drupalcommerce/commerce/pull/659
p.s. i also added a Validation test for Coupons there.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedWe can follow core's example and just extend the existing constraint, which means that we can customize the message without needing to write our own validator class.
Comment #5
bojanz CreditAttribution: bojanz at Centarro commentedDone.
Also replaced the "A coupon with code %value already exists. Enter a unique code." message with "The coupon code %code is already in use and must be unique." to make it match the SKU message. We can change both at the same time if we don't like the phrasing.
Waiting on travis before push: https://travis-ci.org/drupalcommerce/commerce/jobs/209730881
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedComment #8
mglamanYay!