'Refresh the WooCommerce cart page when a product is deleted
Using this question Refresh the page after product remove from cart Woocommerce I added the below code to the head of my website to refresh the WooCommerce cart page when a product is deleted but it does not work. I need the page to refresh as I have a custom product image and it's merging into the product below when deleted unless the cart page is refreshed.
<script>
jQuery('body').on('updated_cart_totals',function() {
jQuery( '.shop_table.cart' ).closest( 'form' ).find( 'input[name="update_cart"]' ).prop( 'disabled', false ); // this will enable the button.
//location.reload(); // uncomment this line to refresh the page.
});
</script>
Solution 1:[1]
Commenting for anyone else who searches for this. Works for me if you remove the // at the start of the location.reload() line as per the instructions. Placed in footer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | John |
