I’m creating a custom booking page and want to add an “Add to Cart” button. I’m using wix-ecom-backend
and the addToCurrentCart()
function, but I’m struggling with the catalogItemId
field.
Since I’m working with a booking service, I expected to find the catalogItemId
when retrieving available slots for a service, but I can’t find it. I’ve tried using the slot ID and schedule ID, but it still doesn’t work.
According to the documentation, the catalogItemId
is required in the options
object:
import { myAddToCurrentCartFunction } from "backend/my-backend-file.web";
const options = {
lineItems: [
{
catalogReference: {
appId: "215238eb-22a5-4c36-9e7b-e7c08025e04e", // Wix Stores appId
catalogItemId: "1a2d7e83-4bef-31d5-09e1-3326ee271c09", //<<<<<<<<<<<<<<<
options: {
variantId: "132b84e8-aab8-47a1-a1f6-2c47557b64a4", // Wix Stores variantId
},
},
quantity: 1,
},
],
};
myAddToCurrentCartFunction(options)
.then((updatedCurrentCart) => {
console.log("Success! Updated cart:", updatedCurrentCart);
})
.catch((error) => {
console.error(error);
});
How can I correctly retrieve the catalogItemId
for a specific slot in a booking service?
Any help would be greatly appreciated!