From 6ded8ec1b9a8417dd52ae50d891ac697c1cb6f3e Mon Sep 17 00:00:00 2001 From: Gerhard Scheikl Date: Sat, 9 May 2026 19:41:12 +0200 Subject: [PATCH] fix(offers): add read_draft_orders scope so draftOrders query works --- app/routes/app.invoices.tsx | 7 +++++++ shopify.app.dev.toml | 2 +- shopify.app.prod.toml | 2 +- shopify.app.toml | 42 +++++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 shopify.app.toml diff --git a/app/routes/app.invoices.tsx b/app/routes/app.invoices.tsx index ac29042..58f17be 100644 --- a/app/routes/app.invoices.tsx +++ b/app/routes/app.invoices.tsx @@ -146,7 +146,14 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { }>; }; }; + errors?: Array<{ message: string }>; }; + if (json.errors?.length) { + console.warn( + "draftOrders query returned errors:", + json.errors.map((e) => e.message).join("; "), + ); + } const nodes = json.data?.draftOrders?.nodes ?? []; const draftIds = nodes.map((n) => n.id); diff --git a/shopify.app.dev.toml b/shopify.app.dev.toml index 4b7a1c9..9768d0d 100644 --- a/shopify.app.dev.toml +++ b/shopify.app.dev.toml @@ -10,7 +10,7 @@ name = "linumiq-invoice-dev" # read_files / write_files for the generated PDFs uploaded to Shopify Files. # write_orders required to write the order metafield linking the latest PDF. # read_all_orders allows access to orders older than 60 days for backfill. -scopes = "read_orders,write_orders,read_all_orders,read_customers,read_companies,read_files,write_files" +scopes = "read_orders,write_orders,read_all_orders,read_draft_orders,read_customers,read_companies,read_files,write_files" [webhooks] api_version = "2026-07" diff --git a/shopify.app.prod.toml b/shopify.app.prod.toml index 73244ed..17cb10d 100644 --- a/shopify.app.prod.toml +++ b/shopify.app.prod.toml @@ -10,7 +10,7 @@ name = "linumiq-invoice" # read_files / write_files for the generated PDFs uploaded to Shopify Files. # write_orders required to write the order metafield linking the latest PDF. # read_all_orders allows access to orders older than 60 days for backfill. -scopes = "read_orders,write_orders,read_all_orders,read_customers,read_companies,read_files,write_files" +scopes = "read_orders,write_orders,read_all_orders,read_draft_orders,read_customers,read_companies,read_files,write_files" [webhooks] api_version = "2026-07" diff --git a/shopify.app.toml b/shopify.app.toml new file mode 100644 index 0000000..06bcbc0 --- /dev/null +++ b/shopify.app.toml @@ -0,0 +1,42 @@ +# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration + +client_id = "fbc263e6cc28e8de031878d2a0f17444" +application_url = "https://invoice-app.linumiq.com" +embedded = true +name = "linumiq-invoice" + +[access_scopes] +# Read orders + customers + companies (B2B) for invoice data. +# read_files / write_files for the generated PDFs uploaded to Shopify Files. +# write_orders required to write the order metafield linking the latest PDF. +# read_all_orders allows access to orders older than 60 days for backfill. +scopes = "read_orders,write_orders,read_all_orders,read_draft_orders,read_customers,read_companies,read_files,write_files" + +[webhooks] +api_version = "2026-07" + + [[webhooks.subscriptions]] + uri = "/webhooks/app/uninstalled" + topics = [ "app/uninstalled" ] + + [[webhooks.subscriptions]] + uri = "/webhooks/app/scopes_update" + topics = [ "app/scopes_update" ] + + [[webhooks.subscriptions]] + uri = "/webhooks/orders/create" + topics = [ "orders/create" ] + + [[webhooks.subscriptions]] + uri = "/webhooks/orders/updated" + topics = [ "orders/updated" ] + +[auth] +redirect_urls = [ + "https://invoice-app.linumiq.com/auth/callback", + "https://invoice-app.linumiq.com/auth/shopify/callback", + "https://invoice-app.linumiq.com/api/auth/callback", +] + +[build] +automatically_update_urls_on_dev = true