This tutorial will walk you through connecting a Shopify data source and how to use the automatically created block in the WordPress editor.
To use the Shopify data source, you need to have an access token. You can create one by following these steps:
- Login to your Shopify admin account.
- Click "Apps" in the left sidebar.
- Click "Apps and sales channels" in the dropdown menu.
- Click "Develop apps".
- Click "Create an app".
- Give the app a name and click "Create app".
- Give the app
unauthenticated_read_product_listings
permissions and click "Install". - Copy the access token from the "API Credentials" section.
- Go to Settings > Remote Data Blocks in your WordPress admin.
- Click on the "Connect new" button.
- Choose "Shopify" from the dropdown menu as the data source type.
- Name the data source. This name is only used for display purposes.
- Enter the subdomain of your Shopify store. To find this, log into Shopify, the subdomain of your store is the portion of the URL before
myshopify.com
. - Enter your access token.
If the credentials are correct, you can save the data source. If you receive an error, check the token and try again.
Create or edit a page or post, then using the Block Inserter, search for the block using the name you provided in step four.
You can use patterns to create a consistent, reusable layout for your remote data. You can read more about patterns and other Core Concepts.
Remote data blocks can be styled using the block editor's style settings, theme.json
, or custom stylesheets. See the example child theme for more details.
You can also configure Shopify integrations with code. These integrations appear in the WordPress admin but can not be modified. You may wish to do this to have more control over the data source or because you have more advanced data processing needs.
This working example will replicate what we've done in this tutorial.