I have successfully recreated the cart page and I would like to prompt a user to checkout after obtain the checkout ID obtained from the current cart. Here is both the backend and frontend code that I used to retrieve the checkout Id. Any help would be appreciated.
import { currentCart } from 'wix-ecom-backend';
export async function myCreateCheckoutFromCurrentCartFunction(options) {
try {
const checkoutId = await currentCart.createCheckoutFromCurrentCart(options);
console.log('Success! Checkout created, checkoutId:', checkoutId);
return checkoutId;} catch (error) {
console.error(error);
// Handle the error
}
}
import { myCreateCheckoutFromCurrentCartFunction } from 'backend/my-backend-file';
"subdivision": "US-NY"
myCreateCheckoutFromCurrentCartFunction(options)
.then((checkoutId) => {
console.log('Success! Checkout created, checkoutId:', checkoutId);
return checkoutId;
})
.catch((error) => {
console.error(error);
// Handle the error
});