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

Shopify Product API 2024 – 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

    ย 

      • Go to Apps โ€“ Manage private apps

    Generate API credentials from the Shopify admin

      ย 

        • 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

        ย 

          • Click Save

        The Admin API section displays the appโ€™s API key and password when you save the appโ€™s details.ย 

        Shopify Connector and Profile arrow Salesforce
        Shopify Salesforce Integration
        Shopify Connector and Profile arrow Capsule
        Shopify Capsule Integration
        Shopify Connector and Profile arrow Apptivo
        Shopify Apptivo Integration

        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

            ย 

              1. {username} โ€“ The API key that you generated.

              1. {password} โ€“ The API password that you generated.

              1. {shop} โ€“ The name of your development store.

              1. {api-version} โ€“ The supported API version that you want to use.

              1. {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

            Example URL

              ย 

                • Paste the URL above.

              POST

              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"]
                  }
              }

              Response:

              API will return all information about newly created products.

              {
                  "product": {
                      "id": 6821639782463,
                      "title": "Burton Custom Freestyle 151",
                      "body_html": "<strong>Good snowboard!</strong>",
                      "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
                  }
              }

              Response

              Step 3: Verify the result

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

              New product

              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.

              https://www.youtube.com/watch?v=HJmQiK5teZw

              Hopefully, you can do it!