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> => {
|
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) {
|
if (!cartId) {
|
||||||
return 'Missing cart ID';
|
return 'Missing cart ID';
|
||||||
@ -53,7 +54,8 @@ export const updateItemQuantity = async ({
|
|||||||
variantId: string;
|
variantId: string;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
}): Promise<String | undefined> => {
|
}): Promise<String | undefined> => {
|
||||||
const cartId = cookies().get('cartId')?.value;
|
const cartId = '1';
|
||||||
|
// const cartId = cookies().get('cartId')?.value;
|
||||||
|
|
||||||
if (!cartId) {
|
if (!cartId) {
|
||||||
return 'Missing cart ID';
|
return 'Missing cart ID';
|
||||||
|
@ -3,7 +3,8 @@ import { cookies } from 'next/headers';
|
|||||||
import CartModal from './modal';
|
import CartModal from './modal';
|
||||||
|
|
||||||
export default async function Cart() {
|
export default async function Cart() {
|
||||||
const cartId = cookies().get('cartId')?.value;
|
// const cartId = cookies().get('cartId')?.value;
|
||||||
|
const cartId = '1';
|
||||||
let cart;
|
let cart;
|
||||||
|
|
||||||
if (cartId) {
|
if (cartId) {
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
import {
|
import {
|
||||||
mockMoney,
|
mockMoney,
|
||||||
mockImage,
|
mockImage,
|
||||||
mockProductOption,
|
|
||||||
mockProductVariant,
|
|
||||||
mockShopifyProduct,
|
mockShopifyProduct,
|
||||||
mockCartItem,
|
mockCartItem,
|
||||||
mockShopifyCart,
|
mockShopifyCart,
|
||||||
|
@ -13,25 +13,6 @@ export const mockImage = {
|
|||||||
height: 500
|
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];
|
export const mockShopifyProduct = adventureProducts[0];
|
||||||
|
|
||||||
// const mockShopifyProductOld = {
|
// const mockShopifyProductOld = {
|
||||||
@ -60,14 +41,19 @@ export const mockShopifyProduct = adventureProducts[0];
|
|||||||
export const mockCartItem = {
|
export const mockCartItem = {
|
||||||
id: 'item1',
|
id: 'item1',
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
cost: { totalAmount: mockMoney },
|
cost: {
|
||||||
|
totalAmount: {
|
||||||
|
amount: '100.00',
|
||||||
|
currencyCode: 'USD'
|
||||||
|
}
|
||||||
|
},
|
||||||
merchandise: {
|
merchandise: {
|
||||||
id: 'merchandise1',
|
id: 'merchandise1',
|
||||||
title: 'Sample Merchandise',
|
title: 'WKDN Adventure',
|
||||||
selectedOptions: [
|
selectedOptions: [
|
||||||
{
|
{
|
||||||
name: 'Color',
|
name: 'Duration',
|
||||||
value: 'Red'
|
value: 'Normal'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
product: mockShopifyProduct
|
product: mockShopifyProduct
|
||||||
@ -78,9 +64,18 @@ export const mockShopifyCart = {
|
|||||||
id: 'cart1',
|
id: 'cart1',
|
||||||
checkoutUrl: 'https://example.com/checkout',
|
checkoutUrl: 'https://example.com/checkout',
|
||||||
cost: {
|
cost: {
|
||||||
subtotalAmount: mockMoney,
|
subtotalAmount: {
|
||||||
totalAmount: mockMoney,
|
amount: '90.00',
|
||||||
totalTaxAmount: mockMoney
|
currencyCode: 'USD'
|
||||||
|
},
|
||||||
|
totalAmount: {
|
||||||
|
amount: '100.00',
|
||||||
|
currencyCode: 'USD'
|
||||||
|
},
|
||||||
|
totalTaxAmount: {
|
||||||
|
amount: '10.00',
|
||||||
|
currencyCode: 'USD'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
lines: { edges: [{ node: mockCartItem }] },
|
lines: { edges: [{ node: mockCartItem }] },
|
||||||
totalQuantity: 1
|
totalQuantity: 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user