DocumentationAmertaThemeUtilitiesCreate cart if not existsFunctions
Create Cart If Not Exists
amerta / amerta/theme/utilities/create-cart-if-not-exists / createCartIfNotExists
Function: createCartIfNotExists()
createCartIfNotExists(
cartId):Promise<Cart|undefined>
Defined in: amerta/theme/utilities/create-cart-if-not-exists.ts:11
Creates a new cart if one does not already exist for the given cartId.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| cartId | any | The unique identifier for the cart. |
Returns
Promise<Cart | undefined>
The existing or newly created cart object.
Example
const cart = await createCartIfNotExists("abc123");