This commit is contained in:
Jieren Chen 2024-09-08 13:28:59 -04:00
parent 95a9377956
commit 4653f74188
No known key found for this signature in database
GPG Key ID: 2FF322D21B5DB10B
5 changed files with 1 additions and 28 deletions

View File

@ -84,7 +84,6 @@ function updateCartTotals(lines: CartItem[]): Pick<Cart, 'totalQuantity' | 'cost
cost: { cost: {
subtotalAmount: { amount: totalAmount.toString(), currencyCode }, subtotalAmount: { amount: totalAmount.toString(), currencyCode },
totalAmount: { amount: totalAmount.toString(), currencyCode }, totalAmount: { amount: totalAmount.toString(), currencyCode },
totalTaxAmount: { amount: '0', currencyCode }
} }
}; };
} }
@ -98,7 +97,6 @@ function createEmptyCart(): Cart {
cost: { cost: {
subtotalAmount: { amount: '0', currencyCode: 'USD' }, subtotalAmount: { amount: '0', currencyCode: 'USD' },
totalAmount: { amount: '0', currencyCode: 'USD' }, totalAmount: { amount: '0', currencyCode: 'USD' },
totalTaxAmount: { amount: '0', currencyCode: 'USD' }
} }
}; };
} }

View File

@ -177,11 +177,7 @@ export default function CartModal() {
<div className="py-4 text-sm text-neutral-500 dark:text-neutral-400"> <div className="py-4 text-sm text-neutral-500 dark:text-neutral-400">
<div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 dark:border-neutral-700"> <div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 dark:border-neutral-700">
<p>Taxes</p> <p>Taxes</p>
<Price <p className="text-right">Calculated at checkout</p>
className="text-right text-base text-black dark:text-white"
amount={cart.cost.totalTaxAmount.amount}
currencyCode={cart.cost.totalTaxAmount.currencyCode}
/>
</div> </div>
<div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 pt-1 dark:border-neutral-700"> <div className="mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 pt-1 dark:border-neutral-700">
<p>Shipping</p> <p>Shipping</p>

View File

@ -165,10 +165,6 @@ export const reshapeCart = (cart: FourthwallCart): Cart => {
amount: totalValue.toString(), amount: totalValue.toString(),
currencyCode, currencyCode,
}, },
totalTaxAmount: {
amount: '0.0',
currencyCode,
}
}, },
lines: cart.items.map(reshapeCartItem), lines: cart.items.map(reshapeCartItem),
// TODO: Stubbed out // TODO: Stubbed out

View File

@ -13,13 +13,11 @@ import {
getProductsQuery getProductsQuery
} from './queries/product'; } from './queries/product';
import { import {
Cart,
Collection, Collection,
Connection, Connection,
Image, Image,
Page, Page,
Product, Product,
ShopifyCart,
ShopifyCollection, ShopifyCollection,
ShopifyCollectionOperation, ShopifyCollectionOperation,
ShopifyCollectionsOperation, ShopifyCollectionsOperation,
@ -97,20 +95,6 @@ const removeEdgesAndNodes = <T>(array: Connection<T>): T[] => {
return array.edges.map((edge) => edge?.node); return array.edges.map((edge) => edge?.node);
}; };
const reshapeCart = (cart: ShopifyCart): Cart => {
if (!cart.cost?.totalTaxAmount) {
cart.cost.totalTaxAmount = {
amount: '0.0',
currencyCode: 'USD'
};
}
return {
...cart,
lines: removeEdgesAndNodes(cart.lines)
};
};
const reshapeCollection = (collection: ShopifyCollection): Collection | undefined => { const reshapeCollection = (collection: ShopifyCollection): Collection | undefined => {
if (!collection) { if (!collection) {
return undefined; return undefined;

View File

@ -102,7 +102,6 @@ export type ShopifyCart = {
cost: { cost: {
subtotalAmount: Money; subtotalAmount: Money;
totalAmount: Money; totalAmount: Money;
totalTaxAmount: Money;
}; };
lines: Connection<CartItem>; lines: Connection<CartItem>;
totalQuantity: number; totalQuantity: number;