How to use setCheckoutId function
Description
This function is used to set the checkout id in the app storage state. This will replace any existing checkout id in the app storage state.
Parameters
| Parameter | Type | Description |
|---|---|---|
| checkoutId | string | The checkout id to set in the app storage state. |
Return value
| Type | Description |
|---|---|
Promise<Checkout> | The checkout object. |
Usage
import { setCheckoutId } from '@appmaker-xyz/shopify';
const checkoutId = 'gid://shopify/Checkout/abcdefgh?key=1234';
const checkout = await setCheckoutId(checkoutId);
if(typeof checkout === 'object') {
// checkout object
console.log(checkout);
} else {
// error
console.log(checkout);
}