Dev: Requirements
Before using the JavaScript API, you need to enable the Persistent Cart App Embed.

Enable the App Embed
- In Shopify Admin, go to Online Store → Themes
- Click Customise on your live theme
- Open the App embeds panel
- Enable Persistent Cart
- Click Save
Once enabled, the helper object becomes available globally:
window.refactor_apps.persistent_cart
If this object is undefined, the App Embed is not active.
Authentication Requirement
In customer-related methods (getCustomerCart, addToCustomerCart, etc.), you need to pass the required customerId parameter:
APIGetCustomerCart(customerId)
In guest-related methods (getGuestCart, updateGuestCart, etc.), the customer should be logged in to process the data:
APIGetGuestCart()
If these conditions are missing, you will receive status: 404. Be ready to handle it
if (window.refactor_apps.persistent_cart) {
const guestCartRes = await window.refactor_apps.persistent_cart.getGuestCart()
if(guestCartRes.status === 401) {
// user should be logged in!
return;
}
// process the guestCartRes.data
return;
}