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.
Problem/Motivation
In the /cart
page, there is an option to remove a product from cart. Add the ability to remove the product from cart ajaxifically.
Proposed resolution
- Create a sub module, say
dc_ajax_add_cart_views
, and it will provide the Views integrations - The sub module is going to provide an ajax remove button (this issue) and ajax update cart button #2910741: Ajaxify the Update cart button
- Write a Views field that will inherit most of the code of
commerce_order_item_remove_button
- Ajaxify the submit button, so that upon clicking, the View itself is going to be refreshed/reloaded/re-rendered
- The ajaxify submit button should also refresh the cart block (if present on the same page)
Remaining tasks
Test cases:
Test case 1:
- Add two different products in cart, say Prod 1, Prod 2
- Click "Remove" button beside Prod 1
- Check if Prod 1 has been removed from cart
- Check if Prod 2 is still present.
- Check if quantity of Prod 2 is still same
Test case 2:
- Check if the "Remove" button is really ajaxified. Refer
AjaxAddCartTest::testAjaxAddCartForm()
User interface changes
Not yet decided.
API changes
Not yet decided.
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
cart-remove.png | 64.44 KB | subhojit777 |
Comments
Comment #2
subhojit777Comment #3
subhojit777Comment #4
subhojit777Comment #6
subhojit777