feat: add activate warranty to order details page

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-06-26 16:35:18 +07:00
parent d801de0cf1
commit 7f4fa09027
11 changed files with 71 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
import lineItemFragment from '../fragments/line-item';
import { orderMetafields } from '../fragments/order';
// NOTE: https://shopify.dev/docs/api/customer/latest/queries/customer
export const getCustomerOrderQuery = /* GraphQL */ `
@@ -220,3 +221,12 @@ export const getCustomerOrderQuery = /* GraphQL */ `
}
${lineItemFragment}
`;
export const getOrderMetafieldsQuery = /* GraphQL */ `
query getOrderMetafields($id: ID!) {
order(id: $id) {
...OrderMetafield
}
}
${orderMetafields}
`;

View File

@@ -1,4 +1,5 @@
import customerDetailsFragment from '../fragments/customer-details';
import { orderMetafields } from '../fragments/order';
const customerFragment = `#graphql
`;
@@ -19,18 +20,10 @@ export const getCustomerOrderMetafieldsQuery = /* GraphQL */ `
customer(id: $id) {
orders(first: 20, sortKey: PROCESSED_AT, reverse: true) {
nodes {
id
warrantyStatus: metafield(namespace: "custom", key: "warranty_status") {
value
}
warrantyActivationDeadline: metafield(
namespace: "custom"
key: "warranty_activation_deadline"
) {
value
}
...OrderMetafield
}
}
}
}
${orderMetafields}
`;