Shopify
[ALPHA-2] This provider for Shopify is in alpha stage. Use at your own risk. Any feedback is very welcome.
Using the provider
site/config/config.php
<?php
return [
'bnomei.kart.provider' => 'shopify',
// other options
];
API Credentials
Create an Shopify App, give it the read_product scope and install it in your shop. Copy the ID and SECRET from your custom Shopify App as config values or via an .env file (plugin).
In Sales Channels search for Headless and install it. Then create a storefront there and copy the Private Access Token as your new storefront token to the .env file.
.env
# from shop
SHOPIFY_STORE_DOMAIN=XXX
# from custom app
SHOPIFY_CLIENT_ID=ZZZ
SHOPIFY_CLIENT_SECRET=shpss_XXX
# from headless storefront
SHOPIFY_STOREFRONT_TOKEN=shpat_YYY
# SHOPIFY_API_VERSION=
Customzing the Checkout
You can use callbacks to customise both the checkout process and each line item. The returned arrays from your callbacks will be merged with the defaults created by the plugin for this provider, allowing you to override those defaults. Check the relevant PHP class and the linked online documentation for the provider to learn more about the expected data structure.
<?php
return [
'bnomei.kart.providers.shopify.checkout_options' => function (\Bnomei\Kart\Kart $kart) {
// configure the checkout based on current kart instance
// ...
return [];
},
'bnomei.kart.providers.shopify.checkout_line' => function (\Bnomei\Kart\Kart $kart, \Bnomei\Kart\CartLine $line) {
// add custom data to the current checkout line
// ...
return [];
},
// other options
];