Ad

Pass Data From Shopify URL To Saved Order

- 1 answer

What is a method of passing custom data through a Shopify URL and having that data stored with the order (for later extraction through reports, admin access, API pull, etc.)?

For example, I would like to produce URLs like

examplestore.com/products/soccerball?aff=123456

(for an external affiliate tracking system), and have that 123456 be saved with the order. Then I could pull the orders from Shopify and know which orders were associated with which affiliates.

I realize there are affiliate apps for use within Shopify, but they seem to want to own the affiliate definition and data. This isn't what I need, as the IDs I pass in are entirely owned and managed by an external system.

Ad

Answer

I found the answer here: Shopify Permalink Cart Preloading

Using a permalink to create a cart with one or more items in it, extra parameters can be added to the URL that provide additional information (including shipping address, but especially including data such as an affiliate id).

For example,

example-store.myshopify.com/cart/variant_id:quantity?ref=external_referral_id

will result in a cart that, when checked out and completed, will store the referral ID with the order.

Ad
source: stackoverflow.com
Ad