skip to Main Content

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.

2

Answers


  1. Chosen as BEST 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.


  2. Shopify allows to add some properties to the line items associated with an order. So, You can add properties to the products before adding to cart.
    for that you can Refer the URL: https://cartjs.org/pages/reference#core-api-add-item

    Now from all your orders you can filter them through the properties in their line items.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search