vsf-external-checkout
vsf-external-checkout copied to clipboard
Cart not clearing on order success
After checkout, when redirected to the /order-success
route the clearTheCart()
function is not getting triggered.
There are 2 listening events being registered on the beforeMount hook, however these events are not triggering this function even though I see the respective mutations and the event being fired during page load.
The event does not show up in the vue devtools and maybe this is because of SSR or some other obscure reason but I would like to understand what's happening here.
In the mean time I just called the function directly in the beforeMount
hook to clear the cart no matter what when the user visits this page as such.
beforeMount () {
this.clearTheCart()
this.$bus.$on('application-after-loaded', (payload) => {
if (document.getElementById('thank_you_external') != null) {
this.clearTheCart()
}
})
this.$bus.$on('cart-after-itemchanged', (payload) => {
if (document.getElementById('thank_you_external') != null) {
this.clearTheCart()
}
})
},