Shopify API - Create A New Product With The Default Product Variant

Shopify Product API 2023 – Create A New Product With The Default Product Variant

Creating a new product is a force for any business running their store on Shopify. There are many ways to create a new product, but in this article, I will show you the basic way to Create a new product with the default product variant using Postman in Shopify.

This way will help you create a new product with the default product variant with information about the tag, name, vendor, and product type but no information about the image, SKU, or price,… 

Let’s explore one by one in this article. 

Step 1: Generate API credentials from the Shopify admin

  • Log in to your Shopify admin
  • Go to Apps – Manage private apps
Generate API credentials from the Shopify admin
Shopify Product API 2023 - Create A New Product With The Default Product Variant 7
  • Click Create a new private app
  • In the App details section, enter a name for your app and an emergency developer email.
  • In the Admin API section, select the areas of your store that you want the app to access
Generate API credentials from the Shopify admin
Shopify Product API 2023 - Create A New Product With The Default Product Variant 8
  • Click Save

The Admin API section displays the app’s API key and password when you save the app’s details. 

Step 2: Create A New Product With The Default Product Variant

  • Log in to your Postman and create a new workspace
  • Create a new POST with this URL:
https://{username}:{password}@{shop}.myshopify.com/admin/api/{api-version}/{resource}.json
Code language: JavaScript (javascript)
  1. {username} – The API key that you generated.
  2. {password} – The API password that you generated.
  3. {shop} – The name of your development store.
  4. {api-version} – The supported API version that you want to use.
  5. {resource} – A resource endpoint from the REST Admin API.

Or you can copy this example in the Shopify Admin, remember to change {resource} to {products}:

https://33a72f01e02987636e1c1a9a4e95c840:[email protected]/admin/api/2021-10/products.json
Code language: JavaScript (javascript)
Example URL
Shopify Product API 2023 - Create A New Product With The Default Product Variant 9
  • Paste the URL above.
POST
Shopify Product API 2023 - Create A New Product With The Default Product Variant 10

In the body section, enter this code, then click Send.

{ "product": { "title": "Burton Custom Freestyle 151", "body_html": "\u003cstrong\u003eGood snowboard!\u003c\/strong\u003e", "vendor": "Burton", "product_type": "Snowboard", "tags": ["Barnes \u0026 Noble", "Big Air", "John's Fav"] } }
Code language: JSON / JSON with Comments (json)

Response:

API will return all information about newly created products.

{ "product": { "id": 6821639782463, "title": "Burton Custom Freestyle 151", "body_html": "Good snowboard!", "vendor": "Burton", "product_type": "Snowboard", "created_at": "2021-12-01T12:37:05+09:00", "handle": "burton-custom-freestyle-151", "updated_at": "2021-12-01T12:37:05+09:00", "published_at": "2021-12-01T12:37:05+09:00", "template_suffix": null, "status": "active", "published_scope": "global", "tags": "Barnes & Noble, Big Air, John's Fav", "admin_graphql_api_id": "gid://shopify/Product/6821639782463", "variants": [ { "id": 39531684790335, "product_id": 6821639782463, "title": "Default Title", "price": "0.00", "sku": "", "position": 1, "inventory_policy": "deny", "compare_at_price": null, "fulfillment_service": "manual", "inventory_management": null, "option1": "Default Title", "option2": null, "option3": null, "created_at": "2021-12-01T12:37:05+09:00", "updated_at": "2021-12-01T12:37:05+09:00", "taxable": true, "barcode": null, "grams": 0, "image_id": null, "weight": 0.0, "weight_unit": "kg", "inventory_item_id": 41626340786239, "inventory_quantity": 0, "old_inventory_quantity": 0, "requires_shipping": true, "admin_graphql_api_id": "gid://shopify/ProductVariant/39531684790335" } ], "options": [ { "id": 8821139767359, "product_id": 6821639782463, "name": "Title", "position": 1, "values": [ "Default Title" ] } ], "images": [], "image": null } }
Code language: JSON / JSON with Comments (json)
Response
Shopify Product API 2023 - Create A New Product With The Default Product Variant 11

Step 3: Verify the result

In the admin, choose products, click all products, then search product by product name.

New product
Shopify Product API 2023 - Create A New Product With The Default Product Variant 12

As you can see, the new product with the default product variant has been created.

I have shown you all steps to create a new product with the default product variant with Shopify API using Postman. If you have any questions, please comment below or refer to our Blog: What is an API? Besides, you can see more Shopify API documentation in the developer docs.

If you still do not understand the tutorial’s content, you can watch the video below for a more overview.

Hopefully, you can do it!