Skip to main content

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

ParameterTypeDescription
checkoutIdstringThe checkout id to set in the app storage state.

Return value

TypeDescription
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);
}