I don’t get an error using the same method, check that the variant actually exists because when I removed the product and tried to create the order I got back the same error but when the product was there I didn’t get any error and instead of “product_id” try using the variant ID.
We’ve seen the same message several times over the last few days, and I was about to post a question about it when I saw this one. I’m not certain if the product is missing in our case because our error logs didn’t include the original request. In any case, it’s a confusing message. Is this something that Shopify have changed recently?
I don’t generally work with creating orders, rather gathering them and sending the data to suppliers. However, I don’t believe an order can be created with just the product_id, instead the variant_id can be used as noted here in the documentation. I know the error message isn’t very clear but to my assumption this means that the price of the product which is tied to the variant_id cannot be null and cannot be read with just the product_id. The three examples below show the JSON sent using just the product_id and using both product_id and variant_id. Using just the product_id will fail with that money field message just like it would if the variant/product did not exist any longer.
Makes sense - thanks. What threw me was the term “money field”, when actually it appears to be referring to price. Maybe “price” is a SQL Server “money” field type behind the scenes?
Facing the same “money field cannot be nil” error here, even when I include a valid variant ID which has available inventory in my request like so:
Thanks for the reports, everyone. I’ve made an issue to track internally with the interest of making this error clearer to API consumers. The issue that you need to be concerned with is the invalid (or not provided) variant_id, and the error message should reflect as much.
Im getting a similar error. For what is looks like, shopify isnt finding the product variant using the variant_id provided. However i made sure that product variant id is correct.
For anyone that finds this like I did, and it did not solve your issue, I hope this does…I encountered this same issue but it had nothing to do with whether or not I supplied a variant_id. In my case I was trying to create an order and in my line_items I was only sending in the title, sku, and quantity. So, by not sending in a variant_id Shopify had nothing to lookup, and therefore couldn’t pull the price which is the required money field it was complaining about. So i add the price field to the line_items being sent in the JSON and the order was created successfully. Hope this helps.
You are not posting enough data for a valid order. You will need to take a look at the API documentation for orders.json and you will see other required fields in the schema. If you pass in all required fields this error should go away. I would recommend something like Postman to do your testing and just keep adding the fields marked as required until you have them all…hope this helps.
Good points. Also, based on the API response there might be an issue with authorization. Ensure the client credentials have access to the scope you are hitting. And if you are using Postman ensure that it’s configured so client cookies aren’t being passed along with your API request.
I actually found the problem in the meantime. I’m not bumping into missing required fields. I could make an order with only the line-item property present.