product variant not found

Highlighted
New Member
3 0 0

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"
    }
}
Below is the post body, I have emptied out the customer, billing and shipping data.
 
{
    "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"
}
 
When I hit the variant API (https://{{store}}/admin/api/2020-04/variants/123.json), I get the variant returned to me no problem. I have other orders placed with this variant with no issues as well.
 
Any input is really appreciated.
0 Likes
Highlighted
New Member
3 0 0

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.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
582 70 127

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 | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
New Member
3 0 0

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.

0 Likes