Hi, I have 2 concerns in reference to this documentation specifically: Create Checkout | Velo
1. Is there a way to properly render the checkout options automatically? Instead of manually creating the required parameters, for instance according to this documentation for createCheckout,* channelType* property is required. The only workaround for me in order to pass this property is to add it manually to the options object.
Do you know any other way to properly render the “options object” for createCheckout():
2. According to docs “must include at least 1 item in the options.lineItems array.”.
The workaround I created for this is to retrieve "lineItems"from the getCurrentCart() Reference: Get Current Cart | Velo
PROBLEM: The actions I did was just for the sake of testing createCheckout(), i manually created options object that contains the required parameters. And then inserted the “lineItems” value from getCurrentCart() to the options object, then finally passed the updated options object to the createCheckout().
RESULT: createCheckout() won’t render anything.
On the same documentation reference page that you shared, there is an example on the right that shows How to create a checkout with minimum required properties.
As you can see in that, the channelType property inside options.lineItems is hardcoded as "WEB", as should be the case for checkouts initiated from your website itself. Also, the appId is hardcoded, as that is the default App ID for Wix Stores.
So these two things need to be hardcoded as is and are required to create a checkout. Other than that, yes the line items, quantities, etc. need to be fetched from the current cart.