Shopify integration

What is Shopify?

Shopify is an e-commerce platform that helps users build and manage their online stores. It offers a wide range of features such as inventory management, payment processing and business marketing allowing you to easily boost sales and save time.

In addition to that, the platform provides Shopify App Store with various third party apps and integrations extending its functionality. Among its additional features you can find customizable templates known as "themes" that you can use for creating your e-commerce store.

Adding Shopify integration to Buddy allows you to automate various tasks tailored to your development needs.
You can e.g. create a pipeline that will update your Shopify themes on every push to branch.

Image loading...Pipeline example for Shopify integration

On top of that, you can use Shopify CLI action for more advanced operations.

What is Shopify CLI?

Shopify CLI is a tool that allows developers to build Shopify apps and themes and interact with them using command-line interface. With the Shopify CLI action you can e.g. test, build or sync Shopify themes and apps directly from your pipeline in Buddy.

Here is an example of a pipeline that runs theme check before pushing it to the store, and sends a notification to the client's Slack channel at the end:

Image loading...Pipeline example with Shopify CLI action

Setting up Shopify integration

  1. Navigate to the Integrations tab and click New integration.
  2. Look up and click Shopify (it can be found under the PaaS category):

Image loading...Shopify integration selection

  1. The configuration window will appear:

Image loading...Shopify integration configuration

Here you have to provide:

  • Integration name, e.g. My Shopify stores
  • Store URL and the Access Token or the API Key depending on the authorization method you have chosen for your integration
Hint
You can adjust the privacy settings of your integration (i.e. who can use it and where) in the Sharing tab.
  1. Once done, click Add a new integration to add the integration to your roster.

Retrieving Shopify access token

To integrate Shopify using the access token:

  1. Log in to your Shopify account and select the store to which you want to deploy.
  2. Go to your shop at:

    admin.shopify.com/store/YOURSHOPNAME/settings/apps/development
  3. Click Create an app to add a new application.
  4. Once added, click Configure Admin API scopes and select these scopes:

    • write_themes
    • read_themes
Hint
If you want to use Shopify CLI action, you can expand the scopes to whatever you require.

Image loading...Configuring API access scopes

  1. Save changes and click Install app to add it to your store.
  2. Copy the newly generated token and paste it in Buddy to finish configuration.

Image loading...API credentials view

Obtaining Shopify Partner Token and API key

Another authorization method to integrate Shopify is by providing Partner Token and API Key (Theme Token).

Hint
This authorization method is designed for Shopify integrations used in Shopify CLI action only.

Image loading...API key authorization

  1. In your Partner Dashboard in Shopify, go to Settings → CLI token, and click Manage tokens.
  2. Click Generate new token and select the appropriate access for your authentication token:
  • UI extensions: For UI extensions, including Checkout UI, Post-purchase UI, Subscription UI, and Web pixel.
  • Functions: For Shopify Functions-based extensions such as order, product, or shipping discounts.

After the token is created, these permissions can't be changed.

Warning
For security reasons, you should grant only the access that's relevant to the project that you're developing. For example, if you're building a product subscription app extension, then you should request only UI extensions access.
  1. Select an expiration for the token from the dropdown list and click Generate token.
  2. In the Tokens section, click the Copy button to copy the token to your clipboard.
  3. For each online store that you want to interact with directly via CLI, you need to get a Theme Access password. These are generated using the Theme Access app.
  4. Paste the generated CLI token in the Partner Token field and the Theme Token in the API KEY field in the configuration window.
Hint
Read how to configure Shopify action and Shopify CLI action with POST parameters.

Last modified on Sep 23, 2024