Discussing APIs and development related to customers, discounts, and order management.
We have a custom store that when an order is placed we create an order in Shopify using the Shopify Ruby gem. Our checkout/process has worked well for many months now. The other day we started getting 400 (bad request) errors back from our posts. We have a retry mechanism in place and some orders eventually go through and others never do. There are other orders that go through with no issues at all. It is really puzzling.
The response from the Ruby gem is:
product variant 123 not found, `price` must provided.
To rule out issues with the gem, I am hit the API directly (https://{{store}}/admin/api/2020-04/orders.json) and get:
{ "errors": { "order": "Required parameter missing or invalid" } }
{ "financial_status": "paid", "line_items": [ { "variant_id": "123", "quantity": 1, "tax_lines": [ { "price": 5.69, "rate": 0.0575, "title": "Ohio State tax" }, { "price": 1.49, "rate": 0.015, "title": "Huron County tax" } ] } ], "total_tax": "7.18", "customer": {}, "billing_address": {}, "shipping_address": {}, "shipping_lines": [ { "code": "Economy", "price": "0.0", "source": "xxxx", "title": "Economy", "tax_lines": [] } ], "send_receipt": false, "send_fulfillment_receipt": false, "suppress_notifications": true, "inventory_behaviour": "decrement_ignoring_policy" }
I cant edit the post, the error should read
{ "errors": { "price": "Required parameter missing or invalid" } }
I have also tried posting with the sku and price instead of the variant with no luck, I still get the error about the price. I have almost 300 orders that are now backlogged because of this issue. But I have other orders that go through with no issue at all.
Hey @jbutler-lf1,
Can you kindly provide the X-Request-ID from the response header of a call that returns an error? I can use this to check our logs and see what's coming through on our end.
JB | Solutions Engineer @ Shopify
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I finally got the orders to go through by setting the shipping cost to 0, and the other bad orders had invalid email addresses. Its odd an invalid email address would return an error about the variant.