beehexa integrationsidebar
beehexa logo

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

Shopify API - Retrieve all variants for a product using Postman

Shopify API 2024 – Retrieve All Variants For A Product Using Postman

The term “variant” refers to a new version of a product. For example, color or size, if you do not create a new variation, shirts in three colors (yellow, blue, and green) will be treated as three separate goods. Using Product Variations, you can think of yellow, blue, and green shirts as three different types of the same shirt.

Each product can have up to 100 variations. At Shopify, almost every business creates new variants of a product. You can read Shopify API: Create A New Product Variant to know more about creating product variants. After creating, the owner sometimes needs to get all variants for a product to make adjustments. This is why I’m going to show you how to retrieve all variants for a product using Postman in Shopify API. 

Remember with Postman in Shopify API. Results will be returned by default with 50 variants per page.

Now let’s explore the article!

If this is the first time you make a call in the Postman, you must generate API credentials from the Shopify admin

Generate API Credentials From Shopify Admin

Follow the process of How to build a custom app for Shopify in 2022? To know how to access Shopify API. 

     

      • After creating an app, you need to assign “Products” scopes to the admin API scopes. 

      • Besides, remember the Admin API access token and the API key to retrieve all variants for a product in the Postman. 

    Before retrieving all the variants for a product, we need to determine the product_id of those variants. Because the command requires all variants for a product that contains product_id.

       

        • From the Admin dashboard, choose products.

        • Then search for the product that you want to retrieve variants of its. 

        • Ultimately, copy the product_id in the URL. 

      Example: The product_id of Beehexa Quickbooks – Shopify T-Shirt 2021 product = 4958434295871

      Now, we are ready to retrieve all variants for a product.

      Shopify Connector and Profile arrow Wix eCommerce
      Shopify Wix Integration
      Shopify Connector and Profile arrow Brivity
      Shopify Brivity Integration
      Shopify Connector and Profile arrow Apptivo
      Shopify Apptivo Integration

      Retrieve All Variants For A Product Using Postman

         

          • First, log in to your Postman and create a new workspace

          • Then create a new GET with this URL:

        https://{API_key}:{admin_API_access_token}@{shop}.myshopify.com/admin/api/{api-version}/{resource}

           

            1. {API_key} – The API key that you generated.

            1. {admin_API_access_token} – The admin API access token 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, remember change {resource} to {products/product_id/variants}:

          https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/products/4958434295871/variants.json

             

              • After that, paste the URL above.

            retrieve all variants for a product

            Then clicks on send

            Response: The API will return all variants of a product. 

            {
                "variants": [
                    {
                        "id": 33375530221631,
                        "product_id": 4958434295871,
                        "title": "Default Title",
                        "price": "100000.00",
                        "sku": "BT002",
                        "position": 1,
                        "inventory_policy": "deny",
                        "compare_at_price": null,
                        "fulfillment_service": "manual",
                        "inventory_management": "shopify",
                        "option1": "Default Title",
                        "option2": null,
                        "option3": null,
                        "created_at": "2021-02-19T16:59:14+09:00",
                        "updated_at": "2021-02-19T16:59:50+09:00",
                        "taxable": true,
                        "barcode": null,
                        "grams": 0,
                        "image_id": null,
                        "weight": 0.0,
                        "weight_unit": "kg",
                        "inventory_item_id": 35539582746687,
                        "inventory_quantity": 100,
                        "old_inventory_quantity": 100,
                        "requires_shipping": true,
                        "admin_graphql_api_id": "gid://shopify/ProductVariant/33375530221631"
                    },
                    {
                        "id": 39627489050687,
                        "product_id": 4958434295871,
                        "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": "2022-03-17T17:37:48+09:00",
                        "updated_at": "2022-03-17T17:37:48+09:00",
                        "taxable": true,
                        "barcode": null,
                        "grams": 0,
                        "image_id": null,
                        "weight": 0.0,
                        "weight_unit": "kg",
                        "inventory_item_id": 41722938818623,
                        "inventory_quantity": 0,
                        "old_inventory_quantity": 0,
                        "requires_shipping": true,
                        "admin_graphql_api_id": "gid://shopify/ProductVariant/39627489050687"
                    },
                    {
                        "id": 39627489148991,
                        "product_id": 4958434295871,
                        "title": "Red",
                        "price": "1.00",
                        "sku": "",
                        "position": 3,
                        "inventory_policy": "deny",
                        "compare_at_price": null,
                        "fulfillment_service": "manual",
                        "inventory_management": "shopify",
                        "option1": "Red",
                        "option2": null,
                        "option3": null,
                        "created_at": "2022-03-17T17:38:09+09:00",
                        "updated_at": "2022-03-17T17:38:09+09:00",
                        "taxable": true,
                        "barcode": null,
                        "grams": 0,
                        "image_id": null,
                        "weight": 0.0,
                        "weight_unit": "kg",
                        "inventory_item_id": 41722938916927,
                        "inventory_quantity": 0,
                        "old_inventory_quantity": 0,
                        "requires_shipping": true,
                        "admin_graphql_api_id": "gid://shopify/ProductVariant/39627489148991"
                    }
                ]
            }

            response_retrieve all variants for a product

            The above are all steps to retrieve all variants for a product using Postman with Shopify API. If you have any questions, please comment below or refer to our Shopify API documentation.

            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=0-4YFrs6JtE
            Shopify API – Retrieve all variants for a product

            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.