# Commission-only affiliate software for Shopify

> Native paid-order attribution with no base fee.

Attribloom is commission-only affiliate software for Shopify with native, server-side paid-order attribution. Start with affiliate discount codes: this released path needs no storefront code or theme edit. Link attribution is an optional second path for more reach, and it requires a small theme change. There is no base fee, and the connector does not rely on a browser pixel to confirm the order.

## Path 1 (no code): affiliate discount codes

Connect the store, approve an affiliate, then copy the affiliate's referral code from their detail page. Create a Shopify discount with that exact code and give it to the affiliate. No storefront or `theme.liquid` change is required. When the code is used at checkout, Shopify includes it in the paid order and Attribloom matches it to the affiliate.

Attribloom calls this a validated discount code: a Shopify checkout code that exactly matches an affiliate referral code already recorded in Attribloom. Commission uses the post-discount merchandise subtotal, excluding tax and shipping.

## Path 2 (optional, more reach): link attribution

Use link attribution when you want to credit a visit without requiring the shopper to enter a discount code. This needs a developer or an AI assistant because your storefront must read `?ref=<affiliate referral code>` and save it on the cart. The exact `theme.liquid` change is below.

## Connect Shopify

1. **Connect your store.** Enter the canonical lowercase `.myshopify.com` address, meaning Shopify's official permanent store address written in lowercase. Complete Shopify OAuth, the permission screen where you authorize Attribloom to read the store events it needs.
2. **Start with the no-code path.** Create a Shopify discount whose code exactly matches the referral code shown on the affiliate's Attribloom detail page. No storefront change is needed.
3. **Optionally add link attribution.** Have a developer or AI assistant add the recipe below so a custom landing URL with `?ref=` can preserve the referral on the cart.
4. **Shopify reports paid orders.** Shopify sends HMAC-signed `ORDERS_PAID` and `REFUNDS_CREATE` webhooks. These are paid-order and refund notifications with a cryptographic signature that lets Attribloom reject tampered messages.
5. **Refunds reconcile automatically.** Full and partial refunds reverse the matching commission on the same double-entry ledger, a balanced accounting record where each money movement has an equal opposite entry.

> **Live today:** The native Shopify connector is live for OAuth connection, paid-order attribution, refund clawback, and daily reconciliation. Use the [universal signed webhook](/guides/webhook) for a custom checkout or another platform.

## What it does not do

Attribloom is not a Shopify App Store listing or a human-affiliate marketplace. It does not recruit partners or publish their content. Merchants connect their store, approve their own affiliates, and give those affiliates links or codes to promote.

## Exact theme change for optional link attribution

This step needs a developer or an AI assistant. Add the snippet below to `theme.liquid`, Shopify's main theme layout file, before `</body>`. It reads `?ref=` and writes a Cart AJAX attribute, extra cart metadata set through Shopify's cart API. Shopify later copies that value to a note attribute, an extra key-value field saved on the order. The Attribloom `/r/<code>` redirect does not add `?ref=`, so use a landing URL that already contains it.

**theme.liquid: copy ref into a Cart AJAX attribute**

```liquid
{% comment %}Place before </body> in theme.liquid.{% endcomment %}
<script>
  (() => {
    const ref = new URLSearchParams(window.location.search).get("ref");
    if (!ref || !/^[A-Za-z0-9_-]{1,128}$/.test(ref)) return;
    fetch(window.Shopify.routes.root + "cart/update.js", {
      method: "POST",
      headers: { "content-type": "application/json" },
      body: JSON.stringify({ attributes: { ref } }),
      credentials: "same-origin",
    }).catch(() => {});
  })();
</script>
```

> **Conflicting signals fail closed:** A validated discount code takes precedence. If the discount and `ref` note attribute identify different affiliates, Attribloom fails closed: it leaves the order unattributed instead of risking credit to the wrong person.

## Verify a paid test order

1. **Confirm the connected store.** Use the canonical lowercase `.myshopify.com` address, Shopify's official permanent store address in lowercase, and approve the OAuth permission screen.
2. **Choose one attribution signal.** Use the affiliate's validated Shopify discount code, or open a storefront URL with `?ref=<affiliate referral code>` and confirm the cart has an attribute named `ref`.
3. **Place a paid test order.** Use Shopify's test payment configuration and complete the order until Shopify emits `orders/paid`. An unpaid draft does not exercise the released paid-order handler.
4. **Observe attribution.** Confirm the Conversions page shows the order for the expected affiliate. The commission base is the post-discount merchandise subtotal, excluding tax and shipping.
5. **Refund and close the loop.** Create a full or partial line-item refund, then confirm the corresponding share of commission is clawed back.

## Primary Shopify sources

Shopify documents [app webhooks](https://shopify.dev/docs/apps/build/webhooks) and the [Cart Ajax API](https://shopify.dev/docs/api/ajax/reference/cart), including cart attributes. Sources checked 2026-07-14.
