diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index 6b1632fe6..882f647ea 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -44,25 +44,26 @@ const reshapeCartItems = (lines: PayloadCart['lines']): CartItem[] => { }; const reshapeCart = (cart: PayloadCart): Cart => { + const currencyCode = cart.currencyCode!; return { id: cart.id, checkoutUrl: '/api/checkout', cost: { totalAmount: { - currencyCode: 'EUR', + currencyCode, amount: cart.totalAmount?.toString()! }, totalTaxAmount: { - currencyCode: 'EUR', - amount: '0.0' + currencyCode, + amount: cart.totalTaxAmount?.toString()! }, subtotalAmount: { - currencyCode: 'EUR', + currencyCode, amount: '0.0' } }, lines: reshapeCartItems(cart.lines), - totalQuantity: 0 + totalQuantity: cart.totalQuantity ?? 0 }; }; diff --git a/lib/shopify/payload-types.ts b/lib/shopify/payload-types.ts index c4842c310..742e8ad1d 100644 --- a/lib/shopify/payload-types.ts +++ b/lib/shopify/payload-types.ts @@ -177,6 +177,9 @@ export interface Product { export interface Cart { id: string; totalAmount?: number | null; + totalTaxAmount?: number | null; + currencyCode?: string | null; + totalQuantity?: number | null; user?: (string | null) | User; lines?: | {