ajax-cart.js: hideOldProducts sometimes does not work #1

Open
opened 2022-04-26 08:12:20 -05:00 by getdatakick · 0 comments
getdatakick commented 2022-04-26 08:12:20 -05:00 (Migrated from github.com)

Method ajaxCart.hideOldProducts is responsible for removing products no longer in the cart.

Products in DOM are indexed using combination of id_product , id_combination and id_address

When figuring out what products to keep, only id_product and id_combination is compared, see line 316.

github.com/thirtybees/blockcart@44322cc5a9/ajax-cart.js (L312-L321)

If the id_address is changed between initial block cart render and subsequent ajax refresh call, then this code fails -- the product line is not removed from the DOM, but a new product line is later added by method ajaxCart.addNewProducts

Method `ajaxCart.hideOldProducts` is responsible for removing products no longer in the cart. Products in DOM are indexed using combination of `id_product` , `id_combination` and `id_address` When figuring out what products to keep, only `id_product` and `id_combination` is compared, see line 316. https://github.com/thirtybees/blockcart/blob/44322cc5a9b44d0b624d22f1add476c8b08eb033/ajax-cart.js#L312-L321 If the id_address is changed between initial block cart render and subsequent ajax refresh call, then this code fails -- the product line is not removed from the DOM, but a new product line is later added by method `ajaxCart.addNewProducts`
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-thirtybees/blockcart#1
No description provided.