https://github.com/dynamic/silverstripe-shopify
https://github.com/dynamic/silverstripe-shopify
ecommerce hacktoberfest shopify silverstripe silverstripe-module
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dynamic/silverstripe-shopify
- Owner: dynamic
- License: bsd-3-clause
- Created: 2020-10-24T02:01:11.000Z (over 4 years ago)
- Default Branch: 1
- Last Pushed: 2024-03-20T15:10:20.000Z (over 1 year ago)
- Last Synced: 2024-12-07T03:19:21.145Z (7 months ago)
- Topics: ecommerce, hacktoberfest, shopify, silverstripe, silverstripe-module
- Language: PHP
- Homepage:
- Size: 300 KB
- Stars: 1
- Watchers: 7
- Forks: 3
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# SilverStripe Shopify
A Shopify Store module for Silverstripe.

[](https://codecov.io/gh/dynamic/silverstripe-shopify)[](https://packagist.org/packages/dynamic/silverstripe-shopify)
[](https://packagist.org/packages/dynamic/silverstripe-shopify)
[](https://packagist.org/packages/dynamic/silverstripe-shopify)
[](https://packagist.org/packages/dynamic/silverstripe-shopify)## Requirements
* silverstripe/recipe-cms ^4.11
* bramdeleeuw/silverstripe-schema ^2.0
* littlegiant/silverstripe-catalogmanager ^5.2
* osiset/basic-shopify-api ^10.0
* symbiote/silverstripe-gridfieldextensions ^3.0## Installation
```
composer require dynamic/silverstripe-shopify
```note - due to an issue with v10.0.6 of `osiset/basic-shopify-api`, we recommend requiring version 10.0.5 of `osiset/basic-shopify-api` if you're running PHP 7.
## License
See [License](license.md)
## Overview
Silverstripe Shopify allows you to create a headless Shopify store using Silverstripe CMS. Products and collections are imported from Shopify, and created as pages in the CMS. The Shopify Buy Button is used to purchase products via the Shopify cart and checkout.
## Setup
### Create a private app
First, ensure that [private apps are enabled](https://help.shopify.com/en/manual/apps/private-apps) in your Shopify Store (this is false by default).
In your Shopify Admin, click `Apps` from the left column navigation. Once the page loads, scroll to the bottom and click on the link in the following line:
`Working with a developer on your shop? Manage private apps`
If no private apps exist, click `Create new private app`. Otherwise, click on the link to the existing private app you'd like to use for your Silverstripe website.
### Obtaining API Keys and Setting Permissions
#### Admin API
In the Admin API section, set the following permissions to `Read Access`
* Customers
* Orders
* Product Listings
* ProductsAll other permissions are optional and are not required for Silverstripe Shopify.
Copy the following keys to the correspoding variables in your config:
* API key > `api_key`
* Password > `api_password`
* Shared Secret > `shared_secret`#### Storefront API
In the Storefront API section, check
* `Allow this app to access your storefront data using the Storefront API`
Check the following permission boxes to enable the access required by Silverstripe Shopify:
* `Read products, variants and collections`
* `Read product tags`
* `Read inventory of products and their variants`
* `Read and modify customer details`
* `Read customer tags`
* `Read and modify checkouts`All other permissions are optional and are not required for Silverstripe Shopify.
Copy the following key to the corresponding variable in your config:
* Storefront access token > `storefront_access_token`
### Basic configuration
```yaml
Dynamic\Shopify\Client\ShopifyClient:
api_key: 'YOUR_API_KEY'
api_password: 'YOUR_API_PASSWORD'
shared_secret: 'YOUR_API_SHARED_SECRET'
storefront_access_token: 'YOUR_ACCESS_TOKEN' # for buy button
shopify_domain: 'YOUR_SHOPIFY_DOMAIN' # mydomain.myshopify.com
custom_domain: 'YOUR_CUSTOM_DOMAIN' # optional - checkout.example.com```
### Using Multipass
```yaml
Dynamic\Shopify\Client\ShopifyMultipass:
multipass_secret: 'YOUR_MULTIPASS_SECRET'
```### Importing products
Once the basic configuration above is setup, you can import Shopify products and collections via CLI using the ShopifyImportTask:
```yaml
vendor/bin/sake dev/tasks/ShopifyImportTask
```or by running the task in the browser at `/dev/tasks/ShopifyImportTask`
## Usage
### CMS
Products and collections are created as pages in the CMS. Products that belong to collections are automatically set as a child page of that collection in the site tree. If a product belongs to multiple collections, the ShopifyProduct page is created under the first listed collection, and subsequent collections will list a VirtualPage of the product.
All products and collections that are available in the private app sales channel will be imported.
Shopify related pages are set as draft or published based on the status set in Shopify. For products, if the product is set to Active in Shopify, it will be published in Silverstripe.
The module creates a CatalogPageAdmin to manage Shopify records via a ModelAdmin, rather than only in the site tree.
The ShopifyProduct page also implements product schema from schema.org. This provides more information to be displayed in search results for google and other search engines.
## Theme
### Cart Include
In your top-level Page.ss template, include the following just before the `