feat: add shipping address to order

:%s
This commit is contained in:
lytrankieio123
2021-10-19 17:30:00 +07:00
parent 461ee218fe
commit ae647003bc
24 changed files with 3767 additions and 159 deletions

View File

@@ -11,6 +11,9 @@ export const cartFragment = /* GraphQL */ `
currencyCode
customer {
id
firstName
lastName
emailAddress
}
lines {
id

View File

@@ -0,0 +1,25 @@
export const setOrderShippingAddressMutation = /* GraphQL */ `
mutation setOrderShippingAddress($input: CreateAddressInput!) {
setOrderShippingAddress(input: $input) {
__typename
... on Order {
id
createdAt
updatedAt
code
shippingAddress {
streetLine1
city
province
postalCode
countryCode
phoneNumber
}
}
... on ErrorResult {
errorCode
message
}
}
}
`

View File

@@ -45,6 +45,11 @@ export function normalizeCart(order: CartFragment): Cart {
subtotalPrice: order.subTotalWithTax / 100,
totalPrice: order.totalWithTax / 100,
customerId: order.customer?.id,
customer: {
firstName: order.customer?.firstName || '',
lastName: order.customer?.lastName || '',
emailAddress: order.customer?.emailAddress || '',
},
lineItems: order.lines?.map((l) => ({
id: l.id,
name: l.productVariant.name,