There is no implementation of commerce_coupon_line_item_add_form() or commerce_coupon_line_item_add_form_submit() in commerce_coupon.module. As a result, when adding a coupon to an order from the admin UI, there is no way to specify which coupon code to use. I was looking at other issues in the issue queue, and it looks like this form used to exist; what happened to it?

Also, note that the submit handler should add a reference to the coupon in the commerce_coupon_order_reference field on the order.

Thanks!

PS - See attached screenshot for what it looks like when trying to add a coupon.

Comments

pcambra’s picture

Status: Active » Closed (duplicate)

Please search the issue queue before adding "major" bug reports.

#1515860: Coupon admin line item add form fixed

jessepinho’s picture

I had seen that before, but for some reason I didn't think it was the exact same issue at the time. Sorry about that!

Am I to understand, then, that the line item form will only show up if a coupon sub-module (like fixed-amount coupon, for example) is installed? Because I don't have any of those installed—I simply have the base Commerce Coupon module installed, and I've created a custom coupon type.

pcambra’s picture

You can't add a coupon line item from the same interface that you would add a product... you can do it in the coupon reference field set as entity reference, that field is called commerce_coupon_order_reference and it's created by commerce_coupon_order_configuration function

jessepinho’s picture

That doesn't actually create a line item for the coupon, though. No discount is applied to the order after I've added a coupon reference to that field, and no coupon line item is created. Any idea why this is/how to fix it? =/

pcambra’s picture

what type of coupon are you using?

jessepinho’s picture

I made a custom coupon type with Amount and User fields. (I've only installed the base Commerce Coupon module.)

pcambra’s picture

Then you need to take care of what you do on add the line item yourself in your module, check pct or fixed amount modules for examples.

jessepinho’s picture

OK. Thanks so much for your help! I do think that this functionality should come with the basic Commerce Coupon module, though (as well as the "granted amount" functionality, which currently shows up as blank for me). I guess I should file that as a feature request. It just seems strange that, to get the basic coupon functionality, you need to install an additional contrib module.