Skip to content

Implement Shopify - #5270

Draft
alexsegura wants to merge 18 commits into
masterfrom
shopify
Draft

Implement Shopify#5270
alexsegura wants to merge 18 commits into
masterfrom
shopify

Conversation

@alexsegura

Copy link
Copy Markdown
Member

Fixes #5269

@alexsegura

alexsegura commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Here's what to do on Shopify to test end-to-end:


Step 1 — Shopify Partner account + dev store

  1. Go to partners.shopify.com and create (or log into) a Partner account.
  2. In the dashboard: Stores → Add store → Development store. Give it a name; you'll use this as your test merchant.

Step 2 — Register the app in the Partner dashboard

  1. Apps → Create app → Create app manually
  2. Set the App URL to https://<YOUR_GATEWAY>/shopify/install
  3. Under Allowed redirection URL(s) add https://<YOUR_GATEWAY>/shopify/callback
  4. Copy the Client ID and Client secret — those go into shopify-gateway/.env as SHOPIFY_API_KEY and SHOPIFY_API_SECRET

For local dev, use ngrok to expose the gateway:

cd shopify-gateway
docker compose up -d        # starts on port 8080
ngrok http 8080             # get https://xxxx.ngrok.io

Use the ngrok URL as YOUR_GATEWAY above, and set APP_URL=https://xxxx.ngrok.io in shopify-gateway/.env.


Step 3 — Install the app on your dev store

Visit https://<YOUR_GATEWAY>/shopify/install in your browser. You'll see the cooperative picker form — enter your CoopCycle instance URL, then click through the Shopify OAuth consent screen. If all goes well
the gateway calls /connect/shopify/provision on your tenant and you should see the ShopifyShop record created in the DB.


Step 4 — Deploy the Delivery Customization Function

The function must be deployed with Shopify CLI (it compiles JS → Wasm and registers it with Shopify):

npm install -g @shopify/cli@latest
cd shopify-app

Point to your app
Edit shopify.app.toml: set client_id to your app's Client ID

shopify app deploy

CLI will ask you to authenticate and pick the development store. After deployment, the function appears under Settings → Shipping and delivery → Delivery customizations in the Shopify admin. You need to enable
it there (it's off by default).


Step 5 — Set postal codes and test checkout

  1. In CoopCycle admin: go to Stores → your store → Shopify, enter some postal codes, and save. This pushes them to the Shopify shop metafield.
  2. In your dev store, put a product in the cart and go to checkout. Try a postal code that's in the list → CoopCycle rate should appear. Try one that's not → it should be hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shopify plugin

1 participant