beehexa integrationsidebar
beehexa logo

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

Shopify API: Create A New Product Variant

Shopify API 2024 : Create A New Product Variant using Postman

A variant is a new version of the product. Example: Colors or sizes. If you don’t create a new variant, you will have to treat shirts with 3 colors, yellow, blue, and green, as 3 separate products. Product Variant allows you to treat yellow, blue and green shirts as 3 variations of the same product as a shirt.

Each product has a maximum of 100 variants. For every business running on Shopify, new variants are required. So, today I will show you how to create a new product variant using Postman in Shopify.

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

  • 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 Capsule
Shopify Capsule Integration
Shopify Connector and Profile arrow Chime
Shopify Chime Integration
Shopify Connector and Profile arrow Lazada
Shopify Lazada Integration

Step 2: Create A New 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/product ID/variants}:

      https://33a72f01e02987636e1c1a9a4e95c840:[email protected]/admin/api/2021-10/products/4356051664959/variants.json

      Example URL

         

          • Paste the URL above.

        Post

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

        {
            "variant": {
                "option1": "Yellow",
                "price": "1.00"
            }
        }

        Response:

        API will return the data like this.

        {
            "variant": {
                "id": 39525900648511,
                "product_id": 4356051664959,
                "title": "Yellow",
                "price": "1.00",
                "sku": "",
                "position": 2,
                "inventory_policy": "deny",
                "compare_at_price": null,
                "fulfillment_service": "manual",
                "inventory_management": "shopify",
                "option1": "Yellow",
                "option2": null,
                "option3": null,
                "created_at": "2021-11-24T11:31:58+09:00",
                "updated_at": "2021-11-24T11:31:58+09:00",
                "taxable": true,
                "barcode": null,
                "grams": 0,
                "image_id": null,
                "weight": 0.0,
                "weight_unit": "kg",
                "inventory_item_id": 41620530987071,
                "inventory_quantity": 0,
                "old_inventory_quantity": 0,
                "requires_shipping": true,
                "admin_graphql_api_id": "gid://shopify/ProductVariant/39525900648511"
            }
        }

        Response

        Step 3: Verify the result

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

        Look at the variant area.

        Variants area

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

        I have shown you all steps to create a new product variant using Postman with Shopify API . If you have any questions, please comment below or refer to our Devdocs

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

        https://youtu.be/mJqMKJuwbfg
        Shopify API: Create a new product variant

        Hopefully, you can do it!

        Table of Contents

        Ready to integrate and automate at scale ?

        Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

        Receive Exclusive Productivity Tips Directly in Your Inbox

        We’ll email you 1-3 times per week—and never share your information.

        Get started for free

        You can’t add more hours to the day. Beehexa is the next best thing.