Setup

You need to be running:

  • Statamic 3.0+
  • PHP 7.4+

It's advisable you also use a queue system that is not sync, for those options you can view the Laravel docs.

This plugin requires a Shopify account to work. If you're testing this, you can create a free Shopify Partner account. When putting your site live, you'll be required to upgrade to a Shopify Lite account. Third-party apps on the Shopify store may interact with how this product works.

Installation

Add statamic-rad-pack/shopify as a dependency to your project:

composer require statamic-rad-pack/shopify

Creating a Shopify App

To set up a private app on Shopify for this add-on to use, use the following steps:

  1. Visit the "Apps" section in your Shopify admin by clicking on the sidebar menu link, then in the modal that appears "App and sales channel settings".
  2. Click "Develop Apps" in the top right.
  3. Click "Create an app" in the top right to make a new one.
  4. Set a nice name to remember as well as your email.
  5. Click the "Configuration" Tab.
    1. Click "Configure" next to Admin API Integration.
    2. Enable read_product_listings, read_inventory, read_products, read_orders, read_translations and write_customers
    3. Click "Configure" next to Storefront API Integration.
    4. Enable unauthenticated_read_product_listings, unauthenticated_read_product_tags, unauthenticated_read_product_inventory, unauthenticated_write_customers, unauthenticated_write_checkouts, unauthenticated_read_customers, unauthenticated_read_checkouts, unauthenticated_read_metaobjects
    5. Click "Save" in the top right.
  6. Click the "API Credentials" tab. Add the Admin API access token to your .env as SHOPIFY_ADMIN_TOKEN, add API key as SHOPIFY_AUTH_KEY, add API secret key as both SHOPIFY_AUTH_PASSWORD and SHOPIFY_WEBHOOK_SECRET, and add Storefront API access token as SHOPIFY_STOREFRONT_TOKEN.
  7. If you've configured the app properly you should see a button that says "Install App". Click this.

Environment Variables

Ensure you've set the necessary environment variables as defined in the "Env Values" section.

Publishable Assets

There are several assets the plugin provides you with

  • Config
  • Blueprints for Products
  • Blueprints for Variants
  • Blueprints for Tags, Vendors, and Type Taxonomies
  • Asset container for Shopify assets
  • Front-end JavaScript to integrate Shopify Storefront API

Quick Setup

When installing the app for the first time it will copy across all of the necessary assets. If you want to manually do this you can run the following command.

php artisan vendor:publish --provider="StatamicRadPack\Shopify\ServiceProvider"

Granular Setup

You can install each asset individually.

Blueprints

php artisan vendor:publish --tag="shopify-blueprints"

Content

php artisan vendor:publish --tag="shopify-content"

Config

php artisan vendor:publish --tag="shopify-config"

JavaScript

Publishes the JavaScript files which have been created to speed up your integration with the Storefront API.

php artisan vendor:publish --tag="shopify-scripts"

Theme Files

You can publish the starter theme files if you want to get started quickly or see how the JavaScript integrates.

php artisan vendor:publish --tag="shopify-theme"
Edit this page on GitHub Updated at Mon, Oct 23, 2023