New features available! Check the changelog
Subscribfy

Cart Attributes

Control Subscribfy discount behavior using cart attributes for headless stores

Use cart attributes to control Subscribfy discount behavior at checkout.

This documentation is for headless stores (Hydrogen, Next.js, etc.) or any store requiring custom discount logic.


Line Item Attributes

Attributes set on individual cart line items:

AttributeTypeDescription
_no_vip_discountstringExclude line item from VIP membership discount
__exclude_store_creditsstringExclude line item from store credits redemption

Set any non-empty value (e.g., "true" or "1") to activate the exclusion.


Cart Attributes

Attributes set on the cart itself:

AttributeTypeDescription
subscribfy_initial_store_creditsstringApply store credits amount at checkout

By default, no store credits are applied. Set this attribute only when you want to apply store credits to the order.


Usage (Storefront API)

Add Line Item with Attributes

mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
  cartLinesAdd(cartId: $cartId, lines: $lines) {
    cart {
      id
    }
  }
}
{
  "cartId": "gid://shopify/Cart/abc123",
  "lines": [{
    "merchandiseId": "gid://shopify/ProductVariant/123",
    "quantity": 1,
    "attributes": [
      { "key": "_no_vip_discount", "value": "true" }
    ]
  }]
}

Set Cart Attributes

mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!) {
  cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
    cart {
      id
    }
  }
}
{
  "cartId": "gid://shopify/Cart/abc123",
  "attributes": [
    { "key": "subscribfy_initial_store_credits", "value": "50.00" }
  ]
}

Alternative: Product Tags

For permanent exclusions, use product tags instead of line attributes:

TagEffect
NO-VIP-DISCOUNTProduct always excluded from VIP discount

Add this tag directly to the product in Shopify Admin. See Shopify Tags for details.


How It Works

  1. Set attributes on cart lines or cart via Storefront API
  2. At checkout, Subscribfy discount functions read these attributes
  3. Lines with exclusion attributes are skipped during discount calculation

Was this page helpful?

On this page

AI Chat

Ask a question about Subscribfy