mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 19:51:23 +00:00
add product to cart, update product in cart, remove product form cart
This commit is contained in:
2
framework/vendure/schema.d.ts
vendored
2
framework/vendure/schema.d.ts
vendored
@@ -3038,7 +3038,7 @@ export type SearchResultFragment = { __typename?: 'SearchResult' } & Pick<
|
||||
SearchResult,
|
||||
'productId' | 'sku' | 'productName' | 'description' | 'slug' | 'sku' | 'currencyCode'
|
||||
| 'productAsset' | 'price' | 'priceWithTax' | 'currencyCode'
|
||||
| 'collectionIds'
|
||||
| 'collectionIds' | 'productVariantId'
|
||||
> & {
|
||||
productAsset?: Maybe<
|
||||
{ __typename?: 'SearchResultAsset' } & Pick<
|
||||
|
@@ -7,6 +7,7 @@ export const searchResultFragment = /* GraphQL */ `
|
||||
slug
|
||||
sku
|
||||
currencyCode
|
||||
productVariantId
|
||||
productAsset {
|
||||
id
|
||||
preview
|
||||
|
@@ -11,6 +11,7 @@ export function normalizeSearchResult(item: SearchResultFragment): ProductCard {
|
||||
imageSrc: item.productAsset?.preview ? item.productAsset?.preview + '?w=800&mode=crop' : '',
|
||||
price: (item.priceWithTax as any).min / 100,
|
||||
currencyCode: item.currencyCode,
|
||||
productVariantId: item.productVariantId?item.productVariantId:"",
|
||||
|
||||
// TODO:
|
||||
// oldPrice: item.price
|
||||
@@ -35,7 +36,7 @@ export function normalizeCart(order: CartFragment): Cart {
|
||||
id: l.id,
|
||||
name: l.productVariant.name,
|
||||
quantity: l.quantity,
|
||||
url: l.productVariant.product.slug,
|
||||
slug: l.productVariant.product.slug,
|
||||
variantId: l.productVariant.id,
|
||||
productId: l.productVariant.productId,
|
||||
images: [{ url: l.featuredAsset?.preview + '?preset=thumb' || '' }],
|
||||
|
Reference in New Issue
Block a user