Importing
Content
The addon currently brings in the following content:
Products.
Images for products.
Variants for products.
Collections
Product Content
The addon pulls the following information for products. Although you can remove any of this from the editor there are a few fields that are required for the addon to work.
Value |
Key |
Description |
Required |
|---|---|---|---|
Product ID |
|
Used to fetch data from the admin API. |
Y |
Storefront ID |
|
Used to integrate the frontend for Shopify |
Y |
Handle |
|
Identifier for products. Sets as slug |
Y |
Title |
|
Product title as shown in Shopify |
|
Body HTML |
|
Any content from the Shopify editor |
|
Product Image |
|
Main image as set in Shopify |
|
Gallery |
|
All further images uploaded to products |
|
Variants |
All variants, assigned to their own blueprint |
||
Vendor |
|
Taxonomy for vendor |
|
Tags |
|
Taxonomy for product tags |
|
Type |
|
Taxonomy for product types |
|
Published at |
|
When the product was published on Shopify |
By default, we overwrite any content pulled from Shopify over the stored values in Statamic.
You can change this by editing the overwrite option in the config file. The following are currently able to be switched between overwriting or not.
/**
* Whether the importer should overwrite data from Statamic.
*/
'overwrite' => [
'title' => true,
'content' => true,
'vendor' => true,
'type' => true,
'tags' => true
]
In addition you can add to the blueprint and any metafields associated with your products will be imported.
Images
Product, variant and collection images are downloaded into the asset container set by SHOPIFY_ASSET_CONTAINER (and SHOPIFY_ASSET_PATH), named after the file in Shopify. Each asset records the Shopify image it came from, so images you change in Shopify are updated on the next import:
A new version of the same file is re-uploaded over the existing asset, as with Statamic's Reupload action. The asset keeps its path and anything you've added to it (alt text, focus point, other fields), and Glide's cached versions are cleared.
A new file for the same image (Shopify serves it under a different file name) is uploaded as a new asset that replaces the old one, as with Statamic's Replace action: Statamic updates every reference to the old asset across your site, including fields you've added yourself, and the new asset gets the old one's data. The old asset is kept unless you set
SHOPIFY_ASSET_DELETE_REPLACED=true.
The asset editor shows the Shopify ID of the image an asset was imported from, read only. Alt text from Shopify is kept in sync on the asset's alt field. The activity log shows how many images an import updated.
Price and stock summary
Each product also stores a summary of its variants, which is updated whenever the product is imported or a variant is edited in the control panel. It lets you sort, filter and display price and stock in product listings without loading every variant.
Value |
Key |
Description |
|---|---|---|
Lowest price |
|
The lowest variant price |
Highest price |
|
The highest variant price |
In stock |
|
Whether any variant can be purchased (has stock, or doesn't deny overselling) |
On sale |
|
Whether any variant has a compare at price above its price |
{{ collection:products sort="price_min:asc" in_stock:is="true" }}
{{ title }} - {{ price_min }}
{{ /collection:products }}
These values come from the variants' top-level fields. In unified multi-store or markets mode, that means the primary store's or default prices, so use {{ shopify:product_price store="..." }} for store or market-specific values.
These fields are in the Pricing and inventory section of the product blueprint's read-only Details tab. The tab also has an Organization section (vendor, type and tags) and a Shopify record section (product ID, published date and shopify_synced_at, shown as Last imported), which keeps the Main tab for content. In stock and Lowest price are shown as columns in the products listing, which you can sort by; the others can be turned on from the listing's column picker.
Existing sites get the new fields (in_stock, on_sale, price_min, price_max and shopify_synced_at) in a Details tab from an update script when they upgrade. It skips any of these fields your blueprint already has and doesn't move your other fields; to match the new layout, drag the product ID, published date and taxonomy fields into the tab in the blueprint editor.
Variants Content
The addon pulls the following information for variants.
Value |
Key |
Description |
Required |
|---|---|---|---|
Variant ID |
|
Used to fetch data from the admin API. |
Y |
SKU |
|
Unique SKU for product |
|
Product Slug |
|
Used to match the variant to the product |
Y |
Title |
|
Variant title as shown in Shopify |
|
Price |
|
The price for the variant |
|
Inventory Quantity |
|
How many products are in stock |
|
Weight |
|
Weight as stored in grams |
|
Option 1 |
|
Option 1 from variant (Default Title if no variants added) |
|
Option 2 |
|
Option 2 from variant (if non, returns null) |
|
Option 3 |
|
Option 3 from variant (if non, returns null) |
|
Requires shipping |
|
Flag for if the product needs shipping |
|
Image |
|
Variant image as set in Shopify |
The above fields will always be overwritten to stay in sync with Shopify
Collections Content
The addon pulls the following information for collections.
Value |
Key |
Description |
Required |
|---|---|---|---|
Collection ID |
|
The Shopify ID for the collection |
Y |
Slug |
|
The handle of the collection in Shopify |
Y |
Title |
|
Collection title as shown in Shopify |
Y |
Content |
|
The content/description of the Collection |
|
Featured Image |
|
The featured image / asset if set in Shopify |
In addition you can add to the blueprint and any metafields associated with your collections will be imported.
Products are assigned to their collections when they're imported. If a product is in a collection that hasn't been imported yet, that collection is imported too, so new collections in Shopify appear without running php artisan shopify:import:collections. Until it has been imported, Statamic shows the collection by its handle. The import is queued once per collection, even when lots of products in it are imported together, and shows in the activity log under the product that found it.
To only assign collections you've already imported, set SHOPIFY_IMPORT_MISSING_COLLECTIONS=false (import_missing_collections).
The above fields will always be overwritten to stay in sync with Shopify