feat(core-flows,types,utils,medusa): Update existing line items when adding the same variant to cart (#7470)
* feat(core-flows,types,utils,medusa): Update existing line items when adding the same variant to cart * chore: split steps into 2 for add-to-cart * chore: split steps into 2 for add-to-cart * chore: iterate safely * chore: parallelize upsert
This commit is contained in:
@@ -45,6 +45,7 @@ export const defaultStoreCartFields = [
|
||||
"items.variant_sku",
|
||||
"items.variant_barcode",
|
||||
"items.variant_title",
|
||||
"items.metadata",
|
||||
"items.created_at",
|
||||
"items.updated_at",
|
||||
"items.title",
|
||||
|
||||
@@ -8,6 +8,7 @@ export const StoreGetCartsCart = createSelectParams()
|
||||
const ItemSchema = z.object({
|
||||
variant_id: z.string(),
|
||||
quantity: z.number(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
})
|
||||
|
||||
export type StoreCreateCartType = z.infer<typeof StoreCreateCart>
|
||||
@@ -62,7 +63,7 @@ export type StoreAddCartLineItemType = z.infer<typeof StoreAddCartLineItem>
|
||||
export const StoreAddCartLineItem = z.object({
|
||||
variant_id: z.string(),
|
||||
quantity: z.number(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
})
|
||||
|
||||
export type StoreUpdateCartLineItemType = z.infer<
|
||||
|
||||
Reference in New Issue
Block a user