chore: add compare_at_unit_price when price list price is retrieved (#9564)
* chore: add compare_at_unit_price when price list price is retrieved * chore: add test for update item + more fixes along the way * chore: fix tests * chore: add refresh spec * Apply suggestions from code review Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com> * chore: use undefined checker * chore: switch to map --------- Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
This commit is contained in:
co-authored by
Adrien de Peretti
parent
827b32cffd
commit
537567b679
@@ -37,8 +37,9 @@ export const AdminPostOrderEditsAddItemsReqSchema = z.object({
|
||||
z.object({
|
||||
variant_id: z.string(),
|
||||
quantity: z.number(),
|
||||
unit_price: z.number().optional(),
|
||||
internal_note: z.string().optional(),
|
||||
unit_price: z.number().nullish(),
|
||||
compare_at_unit_price: z.number().nullish(),
|
||||
internal_note: z.string().nullish(),
|
||||
allow_backorder: z.boolean().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
})
|
||||
@@ -51,7 +52,8 @@ export type AdminPostOrderEditsAddItemsReqSchemaType = z.infer<
|
||||
|
||||
export const AdminPostOrderEditsItemsActionReqSchema = z.object({
|
||||
quantity: z.number().optional(),
|
||||
unit_price: z.number().optional(),
|
||||
unit_price: z.number().nullish(),
|
||||
compare_at_unit_price: z.number().nullish(),
|
||||
internal_note: z.string().nullish().optional(),
|
||||
})
|
||||
|
||||
@@ -61,7 +63,8 @@ export type AdminPostOrderEditsItemsActionReqSchemaType = z.infer<
|
||||
|
||||
export const AdminPostOrderEditsUpdateItemQuantityReqSchema = z.object({
|
||||
quantity: z.number(),
|
||||
unit_price: z.number().optional(),
|
||||
unit_price: z.number().nullish(),
|
||||
compare_at_unit_price: z.number().nullish(),
|
||||
internal_note: z.string().nullish().optional(),
|
||||
})
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ export const defaultStoreCartFields = [
|
||||
"items.title",
|
||||
"items.quantity",
|
||||
"items.unit_price",
|
||||
"items.compare_at_unit_price",
|
||||
"items.is_tax_inclusive",
|
||||
"items.tax_lines.id",
|
||||
"items.tax_lines.description",
|
||||
|
||||
@@ -21,6 +21,7 @@ export const CreateCart = z
|
||||
currency_code: z.string().nullish(),
|
||||
items: z.array(ItemSchema).optional(),
|
||||
sales_channel_id: z.string().nullish(),
|
||||
promo_codes: z.array(z.string()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
@@ -45,7 +46,7 @@ export const StoreRemoveCartPromotions = z
|
||||
export type StoreUpdateCartType = z.infer<typeof UpdateCart>
|
||||
export const UpdateCart = z
|
||||
.object({
|
||||
region_id: z.string().nullish(),
|
||||
region_id: z.string().optional(),
|
||||
email: z.string().email().nullish(),
|
||||
billing_address: z.union([AddressPayload, z.string()]).optional(),
|
||||
shipping_address: z.union([AddressPayload, z.string()]).optional(),
|
||||
|
||||
Reference in New Issue
Block a user