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>