When you create a new discount that uses coupons, you can create coupons within the discount screen itself, which is awesome. However, when you edit the discount later to remove some coupons that you no longer want associated with the discount (because we are re-using the same code on another discount), you can't remove the coupons from the discount edit screen. If you click "Remove" next to the coupon you want removed it disappears, then we save the discount itself. When you edit the discount again, the coupon is back in the list.
The only way I've found to remove a coupon from a discount is to edit the coupon and remove the discount reference from the discount entityreference field on the coupon itself. This is fine, but not quite as intuitive for users that are used to working within the discount screen for all coupon edits.
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce_coupon-fix_discount_edit_screen-2374713-1.patch | 1.22 KB | skyhawk669 |
Comments
Comment #1
skyhawk669 CreditAttribution: skyhawk669 commentedI had the same problem. I checked the code and it looks like it will handle deleting a coupon whenever it is removed from a discount and isn't attached to any other discount, but there isn't any code removing a discount reference from a coupon that is attached to several discounts.
Here's a patch with some code to handle such conditions. I now am able to delete coupons from the discount edit screen.
Comment #3
dpolant CreditAttribution: dpolant commentedI modified the diff slightly and committed this to dev.