Occasionally, the remove button and/or the quantity selectors buttons for each product do not work correctly with bundles.
There are a couple of possible reasons for this:
- The theme is using the product ID to update the product quantity inside the cart
- A third-party app is modifying the behavior of these buttons.
Theme Using Product ID to Update Quantity
When the theme is using the product ID to update the product quantity inside the cart, this is problematic because each instance of a bundle in the cart will share the product ID of the bundle product.
If a customer added 2x Bundle A, both bundles in their cart will share the product ID of Bundle A.
Therefore, if the quantity is updated for one, both instances will be updated.
To fix this, forloop.index should be used instead of item.id wherever the quantity is being changed:
{% for item in cart.items %}
...
<!-- Old -->
<a href="{{ routes.cart_change_url }}?line={{ item.id }}&quantity=0" class="cart__remove">Remove</a>
<!-- New -->
<a href="{{ routes.cart_change_url }}?line={{ forloop.index }}&quantity=0" class="cart__remove">Remove</a>
...
{% endfor %}
Third-Party App Interference
Alternatively, sometimes a third-party app might change the behaviour of the remove button or quantity selectors, which again can cause issues. It is therefore worth checking to see if any cart-related apps have been installed which could be interfering with Bundle Builder.
Checking for Event Listeners
You can also check for 'event listeners' on the button elements, which may point to a script from a third-party app which will run when the button is clicked - in most circumstances there should be none.
To check this on Chrome:
- Right-click and select Inspect.
- Open up the Developer tools.
- Click Inspect Element at the top-left, and select the element you wish to check.
- Click the Event Listeners tab on the bottom-right.
Comments
0 comments
Please sign in to leave a comment.