Skip to content

Shopify Commerce: overview

Staff with access can look up a Shopify product by title inside the Capell admin, without opening Shopify. Search lists up to 20 matches at a time, each showing the product’s title and status. Connect one store to a Capell site from the Shopify Commerce page under Business. The list fills next, with a refresh requested every 15 minutes by default.

Before connecting you need a Shopify app of your own, created in Shopify, with its client ID and secret added to the site’s environment settings. These are the two codes Shopify gives that app. Your host or developer needs to keep both background jobs and the site’s scheduled tasks running. Customer details are copied only if a developer turns that on with a command.

Capell only reads your products and never changes them in Shopify. Each refresh removes any product Shopify no longer returns, so a product you delete in Shopify disappears from Capell by the next one. Visitors never see the list. Staff who can manage the connection can connect, refresh on demand and disconnect. Everyone else with access sees the saved list.

Shopify Commerce connects Shopify Admin API stores to Capell sites, maintains local product and customer caches, and makes an explicitly selected connection’s product data available to integrations. It is not a Shopify product editor, hosted storefront, cart, checkout, order-management, fulfilment, or payment integration.

Run capell-shopify-commerce:install, then complete the application’s package and settings migration process. The installer publishes configuration and migrations and creates manage_shopify_commerce for store management and view_shopify_commerce for cached catalogue access; it does not prove that the migrations have subsequently run.

Create a Shopify app and set SHOPIFY_APP_CLIENT_ID and SHOPIFY_APP_CLIENT_SECRET. Register the Capell OAuth callback URL (/capell/oauth/shopify/callback) in that app. Keep the application encryption key available for stored Admin API tokens. Setting CAPELL_SHOPIFY_COMMERCE_ENABLED=false removes the admin integration surface.

Keep a queue worker and Laravel’s scheduler running. A successful OAuth callback and Sync now both dispatch product-sync work. The scheduler starts a bulk product sync for every Active connection every 15 minutes when scheduled sync is enabled, and prunes abandoned/expired OAuth state rows hourly. Customer synchronisation is not part of that schedule.

Declare the webhook subscriptions for products/create, products/update, products/delete, customers/create, customers/update, customers/delete, shop/update and app/uninstalled in the app’s shopify.app.toml, pointing at the public /capell/webhooks/shopify endpoint, as Shopify recommends. Connecting a store also subscribes it to these topics in one Admin API request. If Shopify refuses the request, the connection stays active, the failure is logged without secrets and the first sync still runs. Run capell-shopify-commerce:webhooks:register to retry; it uses the same action, subscribes every active connection and is safe to repeat.

Go to Integrations > Shopify Commerce, select a site you are allowed to manage, enter the exact myshopify.com domain, and choose Connect. The OAuth state is single-use, bound to the initiating user, shop, and site, and expires after ten minutes. Complete approval in the same authenticated admin session.

The requested scopes come from Shopify Commerce settings and default to read_products and read_customers. Changing the scope list does not change an existing token; reconnect the store and approve the new scopes. Changing the API version affects subsequent API calls, so confirm Shopify supports that version before saving it.

The page manages the latest Active, Connecting, or Error connection for the selected site, while the database and scheduled command can retain more than one Active shop for a site. Keep one intended active connection per site unless an integration deliberately selects among several; an older Active connection can otherwise continue syncing even when it is not the one shown on the page.

The callback stores the Admin API token encrypted, records the granted scopes, marks the connection Active, and queues the first bulk product sync. Use Verify token to make a live shop query. A successful check confirms the token can currently query the shop; it does not validate every requested scope, webhook subscription, queue worker, or cached-data freshness.

Sync now queues work and returns immediately. The job starts a Shopify bulk operation, polls it at the configured interval, downloads its JSONL result, and imports each product and its variants in a short transaction. A successful full import removes cached products and variants that were not present in that result. Product webhooks trigger authenticated fetches or confirmed deletions between full syncs. Webhooks are triggers: product and customer create/update bodies supply only the object ID; data always comes from an Admin GraphQL fetch using the destination connection’s own credentials. Missing or inaccessible objects are logged and dropped without a mirror write. Prices are stamped with the store’s own currency, read from Shopify once and remembered on the connection. A fetched product snapshot older than the stored product, or older than the product’s deletion, is ignored, so delayed retries cannot overwrite newer data or bring a deleted product back; a products/delete is applied only after Shopify confirms the product no longer exists. Variant availability follows Shopify’s rule: untracked variants and variants set to keep selling when out of stock stay available.

The continuation job allows up to 120 polling attempts, with a 15-second delay by default. Shopify GraphQL requests retry HTTP 429 responses up to three attempts and honour Retry-After for at most 60 seconds; other HTTP or GraphQL failures are not silently retried at that layer. Failed starts/imports store a sanitised error and can move the connection to Error. If a sync remains Queued, Running, or Importing for more than 30 minutes, Diagnostics reports it as stale. The page displays failed syncs independently of connection health. Sync now verifies the stored token before recovering an Error connection and queues one import only when eligible. A failed probe leaves the sync unqueued and asks you to reconnect or check app scopes; revoked connections cannot recover this way. Another sync is disabled while work is busy.

Search cached catalogue checks the local cache first for store managers. When a non-empty search has no local result, it makes a live Shopify query and persists the returned products before displaying them. It therefore requires a healthy token and can change the local cache. Management search results are cached for the settings value (five minutes by default) and invalidated by product writes. Catalogue readers search local products only, including while a connection is in Error; a missing match never makes a live request or updates the cache.

Customer data follows a separate lifecycle. Run capell-shopify-commerce:sync-customers {connection} explicitly when a full customer refresh is required. It pages through the API up to the configured limits and upserts customers, but does not delete local customers missing from Shopify. Customer create/update notifications fetch the customer with the destination token before upserting; webhook personal data is never persisted. Customer deletion notifications retire the mirror only after an authenticated lookup confirms absence. customers/redact removes the named customer’s personal data from the local copy when its signed body is delivered for the first time; Shopify provides no confirmation API for this request, shop/redact (sent 48 hours after uninstall) removes every cached customer, product and webhook payload for the store, and customers/data_request raises a ShopifyCustomerDataRequested event so an integration can assemble the data the merchant must send the customer.

Deliveries arrive through Capell Core’s inbound webhook receiver at the same /capell/webhooks/shopify endpoint, limited to 120 requests per minute per source IP. The receiver validates the raw-body HMAC with the Shopify app secret and answers 401 when it fails, as Shopify requires. It then rejects a delivery whose X-Shopify-Triggered-At is missing, unreadable or more than 72 hours from the server clock with 400. Shopify keeps the original trigger time on retries and retries for up to 48 hours, so every retry is accepted. That header is not signed, so the window only refuses a captured delivery resent unchanged long after it was sent; it is no defence against anyone who can set a fresh time. Core stores each delivery once under Shopify’s X-Shopify-Webhook-Id, so a redelivery has no second effect. The delivery is addressed to every Active connection for that exact shop domain (one store can feed several sites), at the installation generation each has when it arrives. Privacy topics are also delivered to revoked connections, because they arrive after uninstall, and are acknowledged with 200 even when no connection exists. A receipt per installation keeps a digest of the signed body with its first-seen topic, so a captured body resent under a new webhook ID changes nothing, the same body cannot be processed under another topic, and an identical privacy webhook runs again after a reinstall because the earlier receipt never covered the new data. Product snapshots older than the stored copy are ignored, and app/uninstalled, products/delete and customers/delete are confirmed with Shopify before acting. shop/redact binds to the latest confirmed uninstalled generation and erases through it, never a live installation; an identical body runs again only after a later confirmed uninstall.

Only the eleven supported topics are accepted; unknown topics return 422 without a stored event. Product/customer notifications retain only object IDs. Compliance notifications retain only shop/customer/request identifiers and the shape markers needed for processing; shop updates and uninstall notifications retain no body. Names, email addresses, phone numbers and addresses are never stored in event payloads. Core keeps the encrypted event and runs it on the queue with five attempts; each installation’s receipt records Pending, Processing, Completed, Failed or Superseded. Once every receipt for an event is Completed or Superseded, its body is cleared. A failed attempt records only the exception class, never its message. Applying an event twice has no second effect, so a retried or replayed event is safe. Core prunes processed and ignored events after 30 days; receipts hold no body and are kept so the digest and shop-redaction guards outlast the event. An event that keeps failing stays in Developer > Webhook Events with its status and failure. Once the cause is fixed, recover it with capell:webhooks:replay {event}; a processed event needs --force and changes nothing that already completed. The bulk replay command, capell-shopify-commerce:webhooks:replay, is retired. The upgrade moves stored Shopify webhook events into Core’s table, queues anything still waiting, and drops the old table. Customer and shop erasure clear retained bodies for the connection.

Disconnect marks the selected local connection Revoked, clears its stored Admin API token and bulk-operation references, and prevents its scheduled sync and webhook handlers from running. It does not call Shopify to uninstall the app or revoke the installation remotely. Remove the app or access in Shopify as well when the relationship must end.

Disconnecting does not delete cached products, variants, customers, webhook receipts, connection metadata, or search-cache entries. Reconnecting the same shop/site reuses the connection row and a later successful product sync refreshes the catalogue. Delete retained local data through an approved application process when it should not remain.

The admin page accepts view_shopify_commerce for cached product lookup or the existing manage_shopify_commerce permission for all supported management actions. Only managers can connect, verify tokens, sync, disconnect or use live search. Both permissions respect assigned sites; an actor with no assigned sites sees no connection or catalogue. Global administrators can select any site and initially default to the lowest-ID site. Existing managers do not need the new view permission. Run the package permission installer when upgrading, then grant the view permission to the intended staff; it is not assigned automatically.

The Admin API token, customer email/name/phone, and webhook event payloads in Core are encrypted. Customer raw_snapshot remains ordinary JSON and can contain the same personal data; the email lookup hash uses the versioned v2: HMAC-SHA-256 scheme, keyed by the application key with a Shopify-specific context. The upgrade rehashes recoverable emails and deduplicates erasure markers. Legacy unkeyed hashes whose original email was already erased remain matchable during transition; new markers use keyed hashes. Lookups accept the current key and every app.previous_keys key. Use the versioned, resumable capell-shopify-commerce:rehash-identities command during rotation, retain previous keys for unrecoverable hash-only markers, and follow the upgrade and rotation procedure. Product snapshots, shop domain, granted scopes, external IDs, marketing state, order count/spend, sync metadata, webhook receipt topic/ID/status, and stored errors are also plaintext. Protect database, cache, queue, logs, backups, and the Shopify app secret accordingly.

Only expired OAuth states have scheduled deletion. Privacy Centre can export and locally anonymise customer mirrors; that local anonymisation can be restored by a later upstream sync. Shopify compliance redaction establishes the persistent erasure fence described above. Customer records and webhook receipts are not automatically pruned; Core prunes finished webhook events after 30 days. Include the local cache in subject-access, correction, erasure, app-uninstall, and retention procedures; do not assume deleting or anonymising a customer in Shopify removes the Capell copy.

The webhook topic and shop-domain headers are unsigned, so compliance requests are checked against the expected signed body shape before processing. A captured genuine redaction body replayed before its legitimate delivery would require interception of Shopify traffic; first-seen body deduplication cannot distinguish that replay. Customer erasure remains intentionally fail-safe: captured genuine erasure bodies can cause erasure, never restoration.

When Contacts is installed, synchronous ShopifyCustomerRedacted and ShopifyShopRedacted events erase Shopify-derived fields, profiles, provenance and activity. Fields and records from forms, events, comments and other sources are preserved; a contact is fully anonymised only when Shopify was its only source. Field provenance is scoped by Shopify connection and installation; erasure restores the most recent remaining source value without clearing fields another shop still supplies. Legacy fields without provable ownership are preserved on mixed-source contacts. A Contacts upgrade builds an indexed source-identity lookup from legacy profiles/activity in batches. Derived erasure runs after the durable Shopify marker fence, outside the connection lock. ShopifyCustomerSynced queues only scalar customer identity and installation generation. Consumers call withCurrentCustomer() to resolve fresh data and recheck both fences under that lock through the derived write, so a pre-erasure or pre-reinstall event cannot restore data. Other consumers of the erasure events must erase synchronously; external logs and backups remain subject to the host retention procedure.

Every OAuth connection or reconnection starts a new installation generation. Shop redaction advances the generation immediately under the connection row lock, then erases customer, product and webhook payload data in bounded transactions. Queued syncs, bulk imports, product writes and stored webhook receipts retain their original generation; ordinary stale work is rejected under that same lock, including work already loaded by a worker. Stale ordinary webhook receipts become Superseded and their bodies are cleared. Compliance erasure and data requests survive reconnects: shop erasure deletes only the recorded generation and never revokes a newer installation, customer identity fences remain effective across installations, and data requests record completion after dispatching a scalar-only ShopifyCustomerDataRequested event (connection ID, customer GID and request ID). Remote API calls, bulk-file reads and catalogue iteration run outside the connection lock; each page/product write rechecks generation and redaction under a brief lock. Reconnecting clears the shop-redaction fence and cached currency for the new installation; customer-redaction identity markers remain effective. Legacy queued syncs without a generation are dropped. A matching generation-less running bulk operation from installation zero is marked Failed and its dispatch receipts are cleared, so a fresh sync can start; newer operations and installations are untouched.


For how to use Shopify Commerce, see the admin guide. For developers: see the README.