Hi, have anyone managed to get add customLineItem working for addTocart
The instruction say you need to add additional permissions to your app. I have done that but i still get
This action requires the following permission scope: Manage eCommerce - Admin Permissions (SCOPE.ECOM.MANAGE-ADMIN)
I am running the function in backend in blocks.
My code:
import { currentCart, cart } from "wix-ecom-backend";
export async function buyButton() {
try {
const res = await currentCart.addToCurrentCart({
customLineItems: [{
catalogReference: { appId: "215238eb-22a5-4c36-9e7b-e7c08025e04e", catalogItemId: "517118e5-d949-6376-eb64-6f1cdeba634e" },
descriptionLines: [{
name: {
original: "Length"
},
plainText: {
original: "500cm"
}
}],
itemType: { custom: "Bag" },
price: "5000",
productName: {
original: "Bag"
},
quantity: 1
}]
});
console.log("Added line items", res);
return res;
} catch (error) {
console.log("Error", error);
return error;
}
}