mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 16:07:01 +00:00
visible cart, with default content. Read only
This commit is contained in:
parent
8b0883d619
commit
38ff03aad6
@ -32,7 +32,8 @@ export const addItem = async (variantId: string | undefined): Promise<String | u
|
||||
};
|
||||
|
||||
export const removeItem = async (lineId: string): Promise<String | undefined> => {
|
||||
const cartId = cookies().get('cartId')?.value;
|
||||
const cartId = '1';
|
||||
// const cartId = cookies().get('cartId')?.value;
|
||||
|
||||
if (!cartId) {
|
||||
return 'Missing cart ID';
|
||||
@ -53,7 +54,8 @@ export const updateItemQuantity = async ({
|
||||
variantId: string;
|
||||
quantity: number;
|
||||
}): Promise<String | undefined> => {
|
||||
const cartId = cookies().get('cartId')?.value;
|
||||
const cartId = '1';
|
||||
// const cartId = cookies().get('cartId')?.value;
|
||||
|
||||
if (!cartId) {
|
||||
return 'Missing cart ID';
|
||||
|
@ -3,7 +3,8 @@ import { cookies } from 'next/headers';
|
||||
import CartModal from './modal';
|
||||
|
||||
export default async function Cart() {
|
||||
const cartId = cookies().get('cartId')?.value;
|
||||
// const cartId = cookies().get('cartId')?.value;
|
||||
const cartId = '1';
|
||||
let cart;
|
||||
|
||||
if (cartId) {
|
||||
|
@ -2,8 +2,6 @@
|
||||
import {
|
||||
mockMoney,
|
||||
mockImage,
|
||||
mockProductOption,
|
||||
mockProductVariant,
|
||||
mockShopifyProduct,
|
||||
mockCartItem,
|
||||
mockShopifyCart,
|
||||
|
@ -13,25 +13,6 @@ export const mockImage = {
|
||||
height: 500
|
||||
};
|
||||
|
||||
export const mockProductOption = {
|
||||
id: 'option1',
|
||||
name: 'Color',
|
||||
values: ['Red', 'Blue', 'Green']
|
||||
};
|
||||
|
||||
export const mockProductVariant = {
|
||||
id: 'variant1',
|
||||
title: 'Red Variant',
|
||||
availableForSale: true,
|
||||
selectedOptions: [
|
||||
{
|
||||
name: 'Color',
|
||||
value: 'Red'
|
||||
}
|
||||
],
|
||||
price: mockMoney
|
||||
};
|
||||
|
||||
export const mockShopifyProduct = adventureProducts[0];
|
||||
|
||||
// const mockShopifyProductOld = {
|
||||
@ -60,14 +41,19 @@ export const mockShopifyProduct = adventureProducts[0];
|
||||
export const mockCartItem = {
|
||||
id: 'item1',
|
||||
quantity: 1,
|
||||
cost: { totalAmount: mockMoney },
|
||||
cost: {
|
||||
totalAmount: {
|
||||
amount: '100.00',
|
||||
currencyCode: 'USD'
|
||||
}
|
||||
},
|
||||
merchandise: {
|
||||
id: 'merchandise1',
|
||||
title: 'Sample Merchandise',
|
||||
title: 'WKDN Adventure',
|
||||
selectedOptions: [
|
||||
{
|
||||
name: 'Color',
|
||||
value: 'Red'
|
||||
name: 'Duration',
|
||||
value: 'Normal'
|
||||
}
|
||||
],
|
||||
product: mockShopifyProduct
|
||||
@ -78,9 +64,18 @@ export const mockShopifyCart = {
|
||||
id: 'cart1',
|
||||
checkoutUrl: 'https://example.com/checkout',
|
||||
cost: {
|
||||
subtotalAmount: mockMoney,
|
||||
totalAmount: mockMoney,
|
||||
totalTaxAmount: mockMoney
|
||||
subtotalAmount: {
|
||||
amount: '90.00',
|
||||
currencyCode: 'USD'
|
||||
},
|
||||
totalAmount: {
|
||||
amount: '100.00',
|
||||
currencyCode: 'USD'
|
||||
},
|
||||
totalTaxAmount: {
|
||||
amount: '10.00',
|
||||
currencyCode: 'USD'
|
||||
}
|
||||
},
|
||||
lines: { edges: [{ node: mockCartItem }] },
|
||||
totalQuantity: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user