I created a custom line item (not based off the Product line item type) type for coupons the customer adds to their cart, which works great so far except for the fact that the Remove button in the views handler will not remove the coupon. I believe this is because the code uses a function which would only remove a product, which is reasonable, though I think coupons are a potential big exception to this. There is a "todo" comment in the code saying that in the future the dependency on the cart api for this functionality should be removed. Just mentioning it here in case this todo was forgotten and to ask if this item might be addressed in the near future. See commerce/modules/line_item/includes/views/handlers/commerce_line_item_handler_field_edit_delete.inc, line 63.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Title: Commerce Line Item Views Handler for Remove From Cart functionality only works for product based line items ('todo' notation pre-existing in code) » Commerce Line Item Views Handler for Remove From Cart functionality only works for product based line items
Version: 7.x-1.9 » 7.x-1.x-dev
Category: Bug report » Task
Status: Needs work » Active

Just triaging the metadata here; there are a wide variety of @todo comments in the code that we don't have issues for, but I think it's fair to treat these as known tasks if we need issues for them. Patches welcome. : D

acrollet’s picture

patch attached.

rszrama’s picture

Status: Needs review » Needs work

This patch still depends on a function from the Cart module, so it doesn't really resolve the @todo.

acrollet’s picture

Status: Needs work » Needs review
FileSize
1.78 KB

Updated patch attached.

Anybody’s picture

See #1365316: Can Not Delete item from cart for an alternative aproach, which I think is cleaner?

Eventually close this as duplicate if the other patch works.