Why getting product Id and variant Id null in Line item, Even i am passing in payload creating order

Shopify Partner
5 0 0


Create An Order API



Passing Payload with product_id and variant_id as shown in screenshot 1

Screenshot 1Screenshot 1


But in response getting null in product_id and variant_id in lines_items  in screenshot 2





Reply 1 (1)

Shopify Staff
1434 234 488

Hi @HspZapbuild


The REST admin API will allow an app to create an order with custom line items. If you are providing product and variant ID values for products/ variants that do not exist on the shop, then it is expected behaviour for the product and variant IDs to be null in the response. 


If you create the product variant first, then you can also create orders by simply including the variant ID and quantity, like the fifth example in our documentation on creating orders.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog