Orders API doesn't add line_item properties

Highlighted
New Member
2 0 1

Using Postman I can add an order here: 

POST https://secret:key@myshop-dev.myshopify.com/admin/api/2020-01/orders.json

 

{"order": {
    "inventory_behaviour": "bypass",
    "send_receipt": true, 
    "email": "derekc@test.com",
    "phone": "+1234567890",
    "buyer_accepts_marketing": true,
    "fulfillment_status": "fulfilled",
    "send_fulfillment_receipt": false,
    "metafields": [
        {
            "key": "new",
            "value": "newvalue",
            "value_type": "string",
            "namespace": "global"
        }
    ],
    "note": "This is a note",
    "tags": "test, voucher",
    "line_items": [
        {
            "title": "My product name",
            "product_id": "m-product-name",
            "product_exists": true,
            "price": "0.00",
            "total_discount": "0.00",
            "requires_shipping": false,
            "quantity": 1,
            "customAttributes": [{
                "key": "imageUrl",
        		"value": "https://placehold.it/300"
        	}],
            "properties": [
            	{
            	    "prop1": "hello",
            	    "prop2": "world"
            	}
            ]
        }
    ],
    "billing_address": {
        "first_name": "Derek",
        "last_name": "C",
        "name": null,
        "address1": "1 Home Road",
        "address2": "",
        "phone": "1234567890",
        "city": "City",
        "zip": "AA1 1AA",
        "province": "Bucks",
        "country": "England",
        "country_code": "GB"
    }
}
}

 

The response is:

 

{
    "order": {
        "id": 2022464323722,
        "email": "derekc@test.com",
        "closed_at": null,
        "created_at": "2020-03-01T14:59:03-05:00",
        "updated_at": "2020-03-01T14:59:04-05:00",
        "number": 26,
        "note": "This is a note",
        "token": "a7e276f078968507e8f82ad33f30c548",
        "gateway": "",
        "test": false,
        "total_price": "0.00",
        "subtotal_price": "0.00",
        "total_weight": 0,
        "total_tax": "0.00",
        "taxes_included": false,
        "currency": "GBP",
        "financial_status": "paid",
        "confirmed": true,
        "total_discounts": "0.00",
        "total_line_items_price": "0.00",
        "cart_token": null,
        "buyer_accepts_marketing": true,
        "name": "#1026",
        "referring_site": null,
        "landing_site": null,
        "cancelled_at": null,
        "cancel_reason": null,
        "total_price_usd": "0.00",
        "checkout_token": null,
        "reference": null,
        "user_id": null,
        "location_id": null,
        "source_identifier": null,
        "source_url": null,
        "processed_at": "2020-03-01T14:59:03-05:00",
        "device_id": null,
        "phone": "1234567890",
        "customer_locale": null,
        "app_id": 3492975,
        "browser_ip": null,
        "landing_site_ref": null,
        "order_number": 1026,
        "discount_applications": [],
        "discount_codes": [],
        "note_attributes": [],
        "payment_gateway_names": [],
        "processing_method": "",
        "checkout_id": null,
        "source_name": "3492975",
        "fulfillment_status": "fulfilled",
        "tax_lines": [],
        "tags": "test, voucher",
        "contact_email": "derekc@test.com",
        "order_status_url": "https://myshop-dev.myshopify.com/32665469066/orders/a7e276f078968507e8f82ad33f30c548/authenticate?key=1f58d14a8ed9ea65f53a7b307e228643",
        "presentment_currency": "GBP",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            }
        },
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            }
        },
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            }
        },
        "subtotal_price_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            }
        },
        "total_price_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            }
        },
        "total_tax_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "GBP"
            }
        },
        "line_items": [
            {
                "id": 4480832045194,
                "variant_id": null,
                "title": "My product name",
                "quantity": 1,
                "sku": null,
                "variant_title": null,
                "vendor": null,
                "fulfillment_service": "manual",
                "product_id": null,
                "requires_shipping": false,
                "taxable": true,
                "gift_card": false,
                "name": "My product name",
                "variant_inventory_management": null,
                "properties": [],
                "product_exists": false,
                "fulfillable_quantity": 0,
                "grams": 0,
                "price": "0.00",
                "total_discount": "0.00",
                "fulfillment_status": "fulfilled",
                "price_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "GBP"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "GBP"
                    }
                },
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "GBP"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "GBP"
                    }
                },
                "discount_allocations": [],
                "admin_graphql_api_id": "gid://shopify/LineItem/4480832045194",
                "tax_lines": []
            }
        ],
        "fulfillments": [
            {
                "id": 1892729847946,
                "order_id": 2022464323722,
                "status": "success",
                "created_at": "2020-03-01T14:59:03-05:00",
                "service": "manual",
                "updated_at": "2020-03-01T14:59:03-05:00",
                "tracking_company": null,
                "shipment_status": null,
                "location_id": 39913619594,
                "line_items": [
                    {
                        "id": 4480832045194,
                        "variant_id": null,
                        "title": "My product name",
                        "quantity": 1,
                        "sku": null,
                        "variant_title": null,
                        "vendor": null,
                        "fulfillment_service": "manual",
                        "product_id": null,
                        "requires_shipping": false,
                        "taxable": true,
                        "gift_card": false,
                        "name": "My product name",
                        "variant_inventory_management": null,
                        "properties": [],
                        "product_exists": false,
                        "fulfillable_quantity": 0,
                        "grams": 0,
                        "price": "0.00",
                        "total_discount": "0.00",
                        "fulfillment_status": "fulfilled",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "GBP"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "GBP"
                            }
                        },
                        "total_discount_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "GBP"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "GBP"
                            }
                        },
                        "discount_allocations": [],
                        "admin_graphql_api_id": "gid://shopify/LineItem/4480832045194",
                        "tax_lines": []
                    }
                ],
                "tracking_number": null,
                "tracking_numbers": [],
                "tracking_url": null,
                "tracking_urls": [],
                "receipt": {},
                "name": "#1026.1",
                "admin_graphql_api_id": "gid://shopify/Fulfillment/1892729847946"
            }
        ],
        "refunds": [],
        "total_tip_received": "0.0",
        "admin_graphql_api_id": "gid://shopify/Order/2022464323722",
        "shipping_lines": [],
        "billing_address": {
            "first_name": "Derek",
            "address1": "Home stree1",
            "phone": "123123123",
            "city": "Town",
            "zip": "AA1 1AA",
            "province": "Bucks",
            "country": "United Kingdom",
            "last_name": "C",
            "address2": "",
            "company": null,
            "latitude": 51.60189,
            "longitude": -0.6501132,
            "name": "Derek C",
            "country_code": "GB",
            "province_code": null
        },
        "customer": {}
    }
}

In the response, the  "properties": []

How do I get the properties to stick?

 

Thanks

0 Likes
Highlighted
New Member
2 0 1

The question is answered here: https://community.shopify.com/c/Shopify-APIs-SDKs/ShopifyAPI-line-item-properties-on-Order-Draft-Ord...

 

Line item properties, cart attributes, note attributes should be added as array of objects in the form of 

{
 "name":"__insert_property_name__",
 "value":"__insert_property_value__" 
}
1 Like