Hello,
I am desperately trying for 8 hours to create a cart with custom line items. Document here -> https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/cart/create-cart
So I created the object below (A simple custom line item based on the documentation and also on the wix platform logs)
So, trying to create the cart using the custom Line Items, I receive the following message:
Line 19 is basically the console.error from the function to create the cart. I don't understand what is the problem here and the error log doesn't give me any indication what is wrong in the code.
Please help me with some advices here :(
Thanks!
"insertId":"..........E2t48_U2W5zNsMqB5XQ8s6""timestamp":"2024-08-27T11:01:14.442Z""labels":{"siteUrl":"https://www.premium-pet-shop.com""revision":"3248""namespace":"Velo""tenantId":"5f617db5-adaa-41fc-aaef-2aae13948ebb""viewMode":"Site"}"sourceLocation":{"file":"backend/cart.web.js""line":119"column":20}"operation":{"id":"1724756471.6962201592661128422""producer":"backend"}"jsonPayload":{"message":"message: '' details: applicationError: description: Forbidden code: FORBIDDEN data: {}"}"severity":"ERROR""receiveTimestamp":"2024-08-27T11:01:14.594Z"
const customLineItem = {
customLineItems: [{
catalogReference: {
appId: APP_ID,
catalogItemId: productId,
},
itemType: {
custom: "test"
},
price: "200",
productName: {
original: "test",
},
quantity: 1,
}],
I suggest access the page with the PC since it is not optimized yet for mobile version.
My cart is in a lightbox and the process to the checkout is done in the lightbox also. This idea came to my mind when I saw the mini cart from wix and I wanted something similar and the only way I found it possible was with a lightbox. If you want you can have a look but unfortunately the site is not multilingual, it is only in Romanian language.
https://www.premium-pet-shop.com
Hi Eitan,
the APP_ID is the one that I received from logs after I published the site with the custom catalog API and the product ID is the one from customCatalog reference. I managed to find an workaround by creating a custom cart instead of working with the wix store one. In this way I was able to use the custom catalog but yeah, a lot of work had to be done for cart page, checkout page and so on. But to be honest it worth it because now I have every single step of a payment flow with my custom code and I don’t use anything from Wix. Only some events feedbacks.
Hi Calin,
I mention this API in the most recent What the Wix?? post. It is not 100% ready yet and has bugs. I think you are right about the elevation in general but otherwise hard to tell. What are you using for the APP_ID and productId? Eitan
I think maybe is the elevation but even using the elevation for cart.createCart it works in one out of 4-5 times. But if I use the elevation, if I run in backend a simple function that calls the cart.createCart, it doesn't work anymore.