Checkout block – Refresh order summary via Ajax/fetch, like before
-
A customer updates the WooCommerce blocks recently, and we spotted an unexpected behaviour. Up until a certain point, changing the billing or shipping address triggered an Ajax/fetch call to refresh the available shipping options and the cart summary. That allowed some of the plugins installed on the client’s site to update the cart totals, setting elements such as prices, currency, VAT and so on.
The latest blocks seem to work in a different way. Instead of triggering an Ajax call, they simply load all the VAT settings (and, by the look of it, a ton of other settings) on the page. When the address changes, the blocks update the VAT element via JavaScript, leaving the rest of the cart summary as it is. This prevents the cart summary from being updated, and the customer is seeing the wrong values. When the checkout actually goes through, the order is different, and so is the amount sent to the payment processor.
I’m not sure if this new behaviour is by design, but it’s going to cause a lot of issues. It’s not feasible to re-implement all the existing price calculation logic as pure JavaScript. I wanted to ask if there could be a way to restore the original behaviour, which relied on the cart content being refreshed via a fetch/Ajax call. If not, then I will have to report the checkout block as incompatible, and recommend the customer to use a different solution.
- The topic ‘Checkout block – Refresh order summary via Ajax/fetch, like before’ is closed to new replies.