|
@@ -50,7 +50,18 @@ function updateItemRow(item_row, cart_items, item_amount) {
|
|
|
// if item quantity goes down to 0, remove it
|
|
// if item quantity goes down to 0, remove it
|
|
|
// from the DOM.
|
|
// from the DOM.
|
|
|
|
|
|
|
|
- let item = cart_items.find(item => item.product_id == item_row.id);
|
|
|
|
|
|
|
+ // Getting the proper item to update on the car page
|
|
|
|
|
+ let item = null;
|
|
|
|
|
+
|
|
|
|
|
+ for (let i = 0; i < cart_items.length; i++) {
|
|
|
|
|
+ if (cart_items[i].product_id == item_row.id) {
|
|
|
|
|
+ if (!cart_items[i].options.product_variation_id || (cart_items[i].options.product_variation_id == item_row.querySelector("#product_id").value)) {
|
|
|
|
|
+ item = cart_items[i];
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (item) {
|
|
if (item) {
|
|
|
|
|
|
|
|
// update quantity value for input field quantity_manual
|
|
// update quantity value for input field quantity_manual
|