Receiving 'not_enough_in_stock' for all product variants when creating a checkout

Solved

Receiving 'not_enough_in_stock' for all product variants when creating a checkout

agriffis
Visitor
1 0 1

When we try to create a checkout via the api, we have been receiving the 'not_enough_in_stock' regardless of the variant we specify.  This is the error we receive:

 

 

 

{
    "errors": {
        "line_items": {
            "0": {
                "quantity": [
                    {
                        "code": "not_enough_in_stock",
                        "message": "You can't add more test shirt - Large / Black to the cart.",
                        "options": {
                            "remaining": 1
                        }
                    }
                ]
            }
        }
    }
}

 

 

We've confirmed that there is enough inventory available, but even when we set the quantity to 1, we get this same error.
 
Other things we've tried is removing the "Track Quantity" checkbox, but still the error persists.
agriffis_0-1636052970632.png

 

Is there something I'm missing when setting up a product, preventing it from being used via the api?

This is what the product object looks like:

 

 

{
            "id": 7429880152281,
            "title": "test shirt",
            "body_html": "",
            "vendor": "CSPlus001",
            "product_type": "",
            "created_at": "2021-11-01T13:00:08-04:00",
            "handle": "test-shirt",
            "updated_at": "2021-11-01T13:00:11-04:00",
            "published_at": null,
            "template_suffix": "",
            "status": "draft",
            "published_scope": "web",
            "tags": "",
            "admin_graphql_api_id": "gid://shopify/Product/7429880152281",
            "variants": [
                {
                    "id": 41985797325017,
                    "product_id": 7429880152281,
                    "title": "Medium / Black",
                    "price": "25.00",
                    "sku": "item1",
                    "position": 1,
                    "inventory_policy": "deny",
                    "compare_at_price": "25.00",
                    "fulfillment_service": "manual",
                    "inventory_management": "shopify",
                    "option1": "Medium",
                    "option2": "Black",
                    "option3": null,
                    "created_at": "2021-11-01T13:00:08-04:00",
                    "updated_at": "2021-11-01T13:00:08-04:00",
                    "taxable": true,
                    "barcode": "",
                    "grams": 4536,
                    "image_id": null,
                    "weight": 10.0,
                    "weight_unit": "lb",
                    "inventory_item_id": 44079575630041,
                    "inventory_quantity": 10,
                    "old_inventory_quantity": 10,
                    "requires_shipping": true,
                    "admin_graphql_api_id": "gid://shopify/ProductVariant/41985797325017"
                },
            "options": [
                {
                    "id": 9446223708377,
                    "product_id": 7429880152281,
                    "name": "Size",
                    "position": 1,
                    "values": [
                        "Medium",
                        "Large",
                        "Small"
                    ]
                },
                {
                    "id": 9446223741145,
                    "product_id": 7429880152281,
                    "name": "Color",
                    "position": 2,
                    "values": [
                        "Black",
                        "White",
                        "Green"
                    ]
                }
            ],
            "images": [
                {
                    "id": 33408525074649,
                    "product_id": 7429880152281,
                    "position": 1,
                    "created_at": "2021-11-01T13:00:11-04:00",
                    "updated_at": "2021-11-01T13:00:11-04:00",
                    "alt": null,
                    "width": 1000,
                    "height": 1000,
                    "src": "https://cdn.shopify.com/s/files/1/0604/6020/4249/products/mookaite.jpg?v=1635786011",
                    "variant_ids": [],
                    "admin_graphql_api_id": "gid://shopify/ProductImage/33408525074649"
                }
            ],
            "image": {
                "id": 33408525074649,
                "product_id": 7429880152281,
                "position": 1,
                "created_at": "2021-11-01T13:00:11-04:00",
                "updated_at": "2021-11-01T13:00:11-04:00",
                "alt": null,
                "width": 1000,
                "height": 1000,
                "src": "https://cdn.shopify.com/s/files/1/0604/6020/4249/products/mookaite.jpg?v=1635786011",
                "variant_ids": [],
                "admin_graphql_api_id": "gid://shopify/ProductImage/33408525074649"
            }
}

 

 

 

 

 

 
Accepted Solution (1)

awwdam
Shopify Staff
249 42 38

This is an accepted solution.

Hey @agriffis,

Took a closer look at the product object you shared, and noticed the following fields denoting publication status: 

"published_at": null

AND

"status": "draft" 

 
I would suggest publishing this product and retrying the initial request to create another checkout - Best! 

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me 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

View solution in original post

Reply 1 (1)

awwdam
Shopify Staff
249 42 38

This is an accepted solution.

Hey @agriffis,

Took a closer look at the product object you shared, and noticed the following fields denoting publication status: 

"published_at": null

AND

"status": "draft" 

 
I would suggest publishing this product and retrying the initial request to create another checkout - Best! 

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me 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