I am new to using discount function but I think I’ve done this right. Despite that, I can’t seem to figure this out. I know its probably something small. None the less.
Below is my query:
query RunInput {
cart {
lines {
id
quantity
attribute {
key
value
}
}
}
}
Here is my cart.
here is the json i get back.
{
"shopId": 87478370625,
"apiClientId": 6930345,
"payload": {
"export": "run",
"input": {
"cart": {
"lines": [
{
"id": "gid://shopify/CartLine/0",
"quantity": 1,
"attribute": null
},
{
"id": "gid://shopify/CartLine/1",
"quantity": 1,
"attribute": null
}
]
}
},
"inputBytes": 156,
"output": {
"discountApplicationStrategy": "FIRST",
"discounts": []
},
"outputBytes": 54,
"logs": [
"No cart lines qualify for free gift card."
],
"functionId": "10dfb89b-06a9-4e17-9342-2da508ffb2cb",
"fuelConsumed": 350035
},
"logType": "function_run",
"status": "success",
"source": "free-gift-card",
"sourceNamespace": "extensions",
"logTimestamp": "2025-01-11T22:42:28.779702Z",
"localTime": "2025-01-11 17:42:28",
"storeName": "may-14-checkout-extensibility.myshopify.com"
}
As you can see the line item attribute returns null but based on the image i displayed there are obviously attributes there. My understanding is that properties and attributes are the same thing.
In order to provide just a bit more info, below is the full cart.json as well if it helps.
{
token: "Z2NwLXVzLWVhc3QxOjAxSkg4Vjc2NlRZVjg5WkU3VlpTMllKWTM2?key=0cae72d5fe50521d826341575dfc2768",
note: "",
attributes: { },
original_total_price: 263995,
total_price: 263995,
total_discount: 0,
total_weight: 0,
item_count: 2,
items: [
{
id: 49846304702785,
properties: {
free_gift_card: "true"
},
quantity: 1,
variant_id: 49846304702785,
key: "49846304702785:a561b1da4577a7b7789a0991f9ee0037",
title: "Free Gift Card with Purchase - $10",
price: 1000,
original_price: 1000,
presentment_price: 10,
discounted_price: 1000,
line_price: 1000,
original_line_price: 1000,
total_discount: 0,
discounts: [ ],
sku: "easy_gift_card_do_not_rename_7eHL4VOJs_10",
grams: 0,
vendor: "may-14-checkout-extensibility",
taxable: false,
product_id: 9825981366593,
product_has_only_default_variant: false,
gift_card: false,
final_price: 1000,
final_line_price: 1000,
url: "/products/free-gift-card-with-purchase?variant=49846304702785",
featured_image: {
aspect_ratio: 1.414,
alt: "Free Gift Card with Purchase",
height: 990,
url: "https://cdn.shopify.com/s/files/1/0874/7837/0625/files/49846304702785.jpg?v=1735445050",
width: 1400
},
image: "https://cdn.shopify.com/s/files/1/0874/7837/0625/files/49846304702785.jpg?v=1735445050",
handle: "free-gift-card-with-purchase",
requires_shipping: true,
product_type: "iziGift",
product_title: "Free Gift Card with Purchase",
product_description: "This gift card is not for purchase. It is soley to be given away with purchases.",
variant_title: "$10",
variant_options: [
"$10"
],
options_with_values: [
{
name: "Price",
value: "$10"
}
],
line_level_discount_allocations: [ ],
line_level_total_discount: 0,
quantity_rule: {
min: 1,
max: null,
increment: 1
},
has_components: false
},
{
id: 48654227767617,
properties: { },
quantity: 1,
variant_id: 48654227767617,
key: "48654227767617:ddfc3123bdbd0708db41402d0b65c52f",
title: "The 3p Fulfilled Snowboard",
price: 262995,
original_price: 262995,
presentment_price: 2629.95,
discounted_price: 262995,
line_price: 262995,
original_line_price: 262995,
total_discount: 0,
discounts: [ ],
sku: "sku-hosted-1",
grams: 0,
vendor: "may-14-checkout-extensibility",
taxable: true,
product_id: 9435246035265,
product_has_only_default_variant: true,
gift_card: false,
final_price: 262995,
final_line_price: 262995,
url: "/products/the-3p-fulfilled-snowboard?variant=48654227767617",
featured_image: {
aspect_ratio: 1,
alt: "Top and bottom view of a snowboard. The top view shows 7 stacked hexagons and the bottom view shows
a small, centred hexagonal logo for Hydrogen.",
height: 1600,
url: "https://cdn.shopify.com/s/files/1/0874/7837/0625/files/Main_b9e0da7f-db89-4d41-83f0-7f417b02831d.jpg?v=1715709633",
width: 1600
},
image: "https://cdn.shopify.com/s/files/1/0874/7837/0625/files/Main_b9e0da7f-db89-4d41-83f0-7f417b02831d.jpg?v=1715709633",
handle: "the-3p-fulfilled-snowboard",
requires_shipping: true,
product_type: "snowboard",
product_title: "The 3p Fulfilled Snowboard",
product_description: null,
variant_title: null,
variant_options: [
"Default Title"
],
options_with_values: [
{
name: "Title",
value: "Default Title"
}
],
line_level_discount_allocations: [ ],
line_level_total_discount: 0,
quantity_rule: {
min: 1,
max: null,
increment: 1
},
has_components: false
}
],
requires_shipping: true,
currency: "USD",
items_subtotal_price: 263995,
cart_level_discount_applications: [ ]
}
I appreciate any help people can offer.
Thanks,
Henry