New Shopify Certification now available: Liquid Storefronts for Theme Developers

Getting option values in Webhook Order Paid Payload?

Solved
johnfr
Shopify Partner
7 0 3

Basically, I have a webhook that is triggered whenever a customer pays an order, which is connected to a google apps script that generates a PDF. The date of the course is stored as a product variant, as well as the « method of payment » the Customer uses (either he pays partly or fully, which is the second option). How do i get those variant/option values in the webhook payload ? The example payload is not very good at showcasing different option values, as the two products shown are the same (as far as I understand), and both line items have « "variant_title": null, ». I’d appreciate any help, as well as a better example JSON that showcases an ordered product containing two or three option values. Thanks, and I hope I have made myself clear enough ! 

Accepted Solution (1)
chris-sellboost
Shopify Partner
22 3 12

This is an accepted solution.

@johnfr of course, check the image, in the previous response attached from webhook, you can see "IPod Nano - 8GB", "IPod Nano" is the product title and "8Gb" the selected option, if you have multiple options, you can see something like "Ipod Nano - 8Gb / Red" or "Ipod Nano - 16Gb / Blue".

chrissellboost_0-1683788770012.png

 

View solution in original post

Replies 5 (5)
chris-sellboost
Shopify Partner
22 3 12

Hi @johnfr are you subscribed to topic orders/paid ?

In this topic you can find the line_items, the property name of a line_item is the result of concatenate the product title and the variant title.

Example:

Click to expand...
    "line_items": [
        {
            "id": 866550311766439000,
            "admin_graphql_api_id": "gid://shopify/LineItem/866550311766439020",
            "fulfillable_quantity": 1,
            "fulfillment_service": "manual",
            "fulfillment_status": null,
            "gift_card": false,
            "grams": 567,
            "name": "IPod Nano - 8GB",
            "price": "199.00",
            "price_set": {
                "shop_money": {
                    "amount": "199.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "199.00",
                    "currency_code": "USD"
                }
            },
            "product_exists": true,
            "product_id": 632910392,
            "properties": [],
            "quantity": 1,
            "requires_shipping": true,
            "sku": "IPOD2008PINK",
            "taxable": true,
            "title": "IPod Nano - 8GB",
            "total_discount": "0.00",
            "total_discount_set": {
                "shop_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                }
            },
            "variant_id": 808950810,
            "variant_inventory_management": "shopify",
            "variant_title": null,
            "vendor": null,
            "tax_lines": [],
            "duties": [],
            "discount_allocations": []
        },
        {
            "id": 141249953214522980,
            "admin_graphql_api_id": "gid://shopify/LineItem/141249953214522974",
            "fulfillable_quantity": 1,
            "fulfillment_service": "manual",
            "fulfillment_status": null,
            "gift_card": false,
            "grams": 567,
            "name": "IPod Nano - 8GB",
            "price": "199.00",
            "price_set": {
                "shop_money": {
                    "amount": "199.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "199.00",
                    "currency_code": "USD"
                }
            },
            "product_exists": true,
            "product_id": 632910392,
            "properties": [],
            "quantity": 1,
            "requires_shipping": true,
            "sku": "IPOD2008PINK",
            "taxable": true,
            "title": "IPod Nano - 8GB",
            "total_discount": "0.00",
            "total_discount_set": {
                "shop_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                }
            },
            "variant_id": 808950810,
            "variant_inventory_management": "shopify",
            "variant_title": null,
            "vendor": null,
            "tax_lines": [],
            "duties": [],
            "discount_allocations": []
        }
    ],

 
Can it help you?

Regards!

 

 

johnfr
Shopify Partner
7 0 3

Hi Chris!

I am in fact subscribed to the orders/paid topic. And I saw the "line_items", though was not able to understand where the variant title is located. Would you be able to provide a clearer/more explicit example of a product name and its variant title? And what would happen if there are multiple options selected? Because as far as I understand, I can just see the product's title. 

Thanks for the help!

chris-sellboost
Shopify Partner
22 3 12

This is an accepted solution.

@johnfr of course, check the image, in the previous response attached from webhook, you can see "IPod Nano - 8GB", "IPod Nano" is the product title and "8Gb" the selected option, if you have multiple options, you can see something like "Ipod Nano - 8Gb / Red" or "Ipod Nano - 16Gb / Blue".

chrissellboost_0-1683788770012.png

 

johnfr
Shopify Partner
7 0 3

Right, that makes a lot of sense ! Thanks a lot. I’ll try this out and reach out if I encounter any issues. Thanks again!

johnfr
Shopify Partner
7 0 3

I want to add to this that you can check the payload for any order by adding .json extension in the Shopify panel, example:
https://admin.shopify.com/store/your-store/orders/4990823071922 
https://admin.shopify.com/store/your-store/orders/4990823071922.json