Request for Assistance:
let cartHelper = {
cartCookieName: "_cart",
getCart: function (callback = undefined) {
return apiHelper.getRequest(
"/carts",
(response) => {
document.cookie = `${this.cartCookieName}=${response.data.attributes.cart_guid};`;
if (callback) { callback(); }
},
)
},
}
I am seeking guidance on implementing a check to call the getCart function only if " _cart" is empty. Specifically, the getCart function should be triggered when a button is clicked. This function makes an API call to obtain the cart_guid and stores it in a cookie. My objective is to skip creating the cookie with cartguid if the cart_guid already exists in the cookie.
Thank you for your assistance!