I have a Nuxt frontend for a WooCommerce store. What would be the best way to clear the cart in this setup? My current (only) go at this is to clear the cart using ajax call to WordPress on thank-you page, that does this:
WC()->cart->empty_cart(true);
WC()->session->set('cart', array());
WC()->session->set('order_awaiting_payment', null);
But this seems reliant on too many factors and if any of them blows, the end user will be left in doubt.