4 Commits

Author SHA1 Message Date
01935dc92e fix locationId: use shop primary location instead of fulfillment service location (Shopify never returns it) 2026-07-03 00:09:24 +05:30
cceb714a73 fix double response in auth callback + re-query fulfillment service location when null 2026-07-03 00:04:12 +05:30
fb7d447648 fix: robust fulfillment service + locationId setup with backfill endpoint
fulfillmentService.js:
- If fulfillmentServiceCreate returns userErrors (already exists), query
  existing service via fulfillmentServices(type:THIRD_PARTY) instead of failing
- Fix provinceCode bug: was using address.phone instead of address.provinceCode
- Fix location lookup: search locations(first:1) instead of by exact name
  'Shop location' (most stores use different names)
- Use JSON.stringify for all string fields to avoid GraphQL injection
- Fallback: if locationAdd fails (missing write_locations scope or address error),
  use fulfillmentService.location.id as the locationId — so locationId is NEVER
  null when a fulfillment service exists

server.js:
- Import saveToken and createFulfillmentService
- Add GET /admin/fix-location/:shop? endpoint to backfill shops with null
  locationId without requiring reinstall

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 23:42:00 +05:30
Manesh
624c2f2d32 first commit 2026-04-13 05:23:25 +00:00