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:
| Attribute | Type | Description |
|---|---|---|
_no_vip_discount | string | Exclude line item from VIP membership discount |
__exclude_store_credits | string | Exclude 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:
| Attribute | Type | Description |
|---|---|---|
subscribfy_initial_store_credits | string | Apply 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:
| Tag | Effect |
|---|---|
NO-VIP-DISCOUNT | Product always excluded from VIP discount |
Add this tag directly to the product in Shopify Admin. See Shopify Tags for details.
How It Works
- Set attributes on cart lines or cart via Storefront API
- At checkout, Subscribfy discount functions read these attributes
- Lines with exclusion attributes are skipped during discount calculation
Was this page helpful?