I'm encountering a weird issue, on the frontend, whenever I add a product to the cart it will be added there and the icon gets updated to show the 1 to indicate there's an item.
Whenever I change the page, the cart gets shown as being empty.
In this step I'll add a product again, now it will show the updated cart (the old content will be present too).
I'd expect the content of the cart to always be shown on the frontend. I suspect the issue lies with the theme or caching, but I'm not entirely sure. I hope someone can help me out here with debugging or resolving the issue.
I'm using the vc-theme-material theme.
Using version 2.13.28
.
It seems like the request to update the cart on initial load was missing. I've submitted a PR you can see here: https://github.com/VirtoCommerce/vc-theme-material/pull/15.
If you want to fix it yourself, edit assets/rt.global.js
to inlcude the following function:
function updateCart() {
Shopify.getCart(function (e) {
setTimeout(function () {
jQuery("body").removeClass("is_loading"),
roar.timeout = setTimeout(function () {
roar.closeThemeCtl2()
}, 5e3)
}, 500), Shopify.updateCartInfo(e, ".cart-info")
})
}
And execute it on init load:
var GLOBAL = {
common: {
init: function () {
updateCart()
// other code
}
}
},
Example of the full snippet after edits can be found here: https://github.com/S3B4S/vc-theme-material/commit/44785616bf614f727b094c308957ae0bf8da173a