Solved

Create Product With Inventory Levels, API 2021-07

aodreman
Visitor
2 1 0

I have been trying to create a product using the latest API, the product is created but it doesn't activate the inventory tracking. Moreover, I sending the SKU and inventory levels, but those don't show up in the backend.

Here is the payload.

{
  "product": {
    "sku": "IPOD2008RED",
    "status": "active",
    "title": "Ninja DZ201 Foodi 6-in-1 2-Basket Air Fryer with DualZone Technology, 8-Quart Capacity, and a Dark Grey Stainless Finish",
    "body_html": "<li>The first air fryer with 2 independent baskets that lets you cook 2 foods, 2 ways, at the same time, not back to back like a traditional single-basket air fryer</li><li>DualZone Technology features Smart Finish feature for cooking 2 foods 2 ways that finish at the same time, and a Match Cook button to easily copy settings across zones for full 8-qt capacity</li><li>6 customizable programs: Air Fry, Air Broil, Roast, Bake, Reheat, and Dehydrate</li><li>XL 8-quart air fryer capacity lets you fit mains and sides at the same time for making quick family meals, or up to 4 lbs. of French fries or chicken wings</li><li>2 independent 4-quart zones have their own cooking baskets, cyclonic fans, and rapid heaters</li><li>Easy-to-clean baskets and dishwasher-safe crisper plates</li><li>Wide temperature range: 105°F–450°F</li>",
    "vendor": "Ninja",
    "price": 1991.00,
    "product_type": "Air Fryer",
    "metafields_global_title_tag": "Air Fryer Ninja DZ201",
    "tags": "Emotive, Flash Memory, MP3, Music",
    "inventory_management": "shopify",
    "inventory_quantity": 20,
    "metafields_global_description_tag": "Eliminate back-to-back cooking with the Ninja Foodi 2-Basket Air Fryer with DualZone Technology. Two easy-to-clean 4-qt baskets have their own dishwasher-safe crisper plates to provide the versatility for cooking 2 foods, or up to 8-qts of one food at the same time.",
    "metafields": [
      {
        "key": "short_description",
        "value": "Eliminate back-to-back cooking with the Ninja Foodi 2-Basket Air Fryer with DualZone Technology. Two easy-to-clean 4-qt baskets have their own dishwasher-safe crisper plates to provide the versatility for cooking 2 foods, or up to 8-qts of one food at the same time.",
        "value_type": "string",
        "namespace": "jvg"
      }
    ],
    "images": [
      {
        "src": "https://lorempixel.com/400/200/technics/"
      },
      {
        "src": "https://lorempixel.com/400/200/food/"
      }
    ]
  }
}

Any help would be appreciated, Thanks.

Accepted Solution (1)

aodreman
Visitor
2 1 0

This is an accepted solution.

Well, after checking different threads I found that when you create a new product this creates a default variant. So, passing the information of a single variant in product creation allows us to add the additional fields I was asking for. Just add a variants array with the information as follows.

    "variants": [
			{
                "sku": "IPOD2008RED",
				"title": "Default Title",
				"price": "1921.00",
                "inventory_management": "shopify",
                "inventory_quantity": 20
			}
    ]   

Thanks, I hope this helps someone with the same issue.

Reference:
https://community.shopify.com/c/Shopify-APIs-SDKs/how-can-I-create-product-without-variants-using-ap...

View solution in original post

Reply 1 (1)

aodreman
Visitor
2 1 0

This is an accepted solution.

Well, after checking different threads I found that when you create a new product this creates a default variant. So, passing the information of a single variant in product creation allows us to add the additional fields I was asking for. Just add a variants array with the information as follows.

    "variants": [
			{
                "sku": "IPOD2008RED",
				"title": "Default Title",
				"price": "1921.00",
                "inventory_management": "shopify",
                "inventory_quantity": 20
			}
    ]   

Thanks, I hope this helps someone with the same issue.

Reference:
https://community.shopify.com/c/Shopify-APIs-SDKs/how-can-I-create-product-without-variants-using-ap...