AJAX update cart values when quantity is updated

17 1 0

I'm trying to re-design the standard debut cart page but I can't find a way to update my newly added block when the product quantity is updated.


Here is a screenshot of the new cart page:

2020-10-02 05_48_33-Your Shopping Cart – Trimmer Boss.png


I need to update the highlighted values every time the quantity is changed.


RED ($279.96) - Compare at price * Quantity

GREEN ($0.00) - (Compare at price * Quantity) - (New Price * Quantity)

BLUE ($139.98) - New price * Quantity



And on top of that I have BOLD Quantity breaks installed so I need to have a condition running every time the quantity input is changed, similar to this:


if (item.quantity === 2) {
 let new_price = item.original_line_price * 0.8; //20% OFF discounted created by BOLD
else if ( item.quantity > 2) {
 let new_price = item.original_line_price * 0.3; //30% OFF discounted created by BOLD
else {
 let new_price = item.original_line_price;



Is it a good practice to edit the theme.js file directly in order to make these changes?

Any suggestions on the cleanest way to make it this work are highly appreciated, thanks.