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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skyhawk669’s picture

Status: Active » Needs review
FileSize
1.22 KB

I 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.

  • skyhawk669 authored 7be19e9 on 7.x-2.x
    Issue #2374713 by skyhawk669: Unable to remove coupons from discount...
dpolant’s picture

Status: Needs review » Fixed

I modified the diff slightly and committed this to dev.

Status: Fixed » Closed (fixed)

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