Shopify Extension Setup Guide

You can add a Shopify custom field extension in your stack that allows you to fetch the products/items of your Shopify store and display them into a field in your Content Type. Subsequently, while creating entries, you can select one or more listed products as input value for the field.

This step-by-step guide explains how to create a Shopify custom field extension for your content types in Contentstack. The steps performed are as follows:

  1. Add the ‘Shopify’ custom field extension to your stack
  2. Use your custom field

Step 1 - Add the ‘Shopify’ custom field extension to your stack

  1. Go to Settings > Extensions. Click on the ‘+ Add Extension’ button on the top-right corner and select ‘Create new’.
    Create New Extension.png
  2. Select Custom Field.
    Select Extension Type - Custom Field.png
  3. On the configuration page, enter details in the fields as given below:
    • Title: Provide a suitable title for your custom field. For example, ‘Shopify’.
    • Field Data Type: Select the data type in which the input data of the field should be saved in Contentstack. Select ‘Text’ in this case.
    • Multiple: Select this checkbox if you want to enable multiple inputs for the field.
    • Hosting method: Select ‘Hosted By Contentstack’. As soon as you do this, you will see the ‘Extension Source Code’ field below.
    • Extension Source Code: Enter the source code for the custom field. You can find the source code for the Shopify custom field here.
    • Config Parameter: You need to provide the domain of your application and the access token of the Shopify Storefront API in this field.
      {
          "domain": "sampleshop.myshopify.com",
          "storefrontAccessToken": "{storefrontAccessToken}"
      }

      To retrieve the 'Access Token' of Storefront API, refer the documentation.

      Note: You can provide different configuration settings for specific instances of your Custom Field Extension when setting up your content type. The configuration that you provide for an instance will only be applicable for that instance and will not affect any other instances of the same custom field extension or any other fields within the same content type. Learn more.

  4. Click on ‘Save’. This creates your custom field.

Now, let’s understand how you can start using this custom field in your content type.

Step 2 - Use your custom field

To use your custom field, you need to follow the steps given below:

  1. Create a content type by clicking on the ‘+ New Content Type’. Enter the relevant details for the content type and click on ‘Create and Add fields’.
    Create Content Type.png
    This leads you to the ‘Content Type Builder’ page where you can add the relevant fields.
  2. Add the ‘Custom’ field in your content type.
    Add 'Custom' Field.png
  3. Select 'Shopify' from the dropdown and set the other properties of your custom field.
    Dropdown Shopify.png

    Note: You can provide specific instance-level configuration settings for your Custom Field extension. Learn more.

  4. After adding other relevant fields in your Content Type, click on Save and Close.

This will create your Content Type. Now you can use the custom field while creating an entry for this Content Type as shown below:

Shopify.png

Was this article helpful?
top-arrow