Kirby Shopify Plugin

Alright, it seems to be right indeed !
I don’t understand why it can’t get the value.
Is it well setup like this in the .env ?

I managed to get it working! It was my mistake, sorry. I got mixed up between the panel from the live URL and the panel from the localhost… That’s what I get for trying to work while tired! The .env file has the API key and password, and the products now appear in the panel :slight_smile:

Thank you so much for your help and patience! (And for developing this great plugin)

Now I just need to integrate the front-end. It’s possible to customize the buy buttons and the cart as much as we want, right? (add the cart to an existing , add the buy buttons to existing links…)

I am glad you found the solution :slight_smile:

Now I just need to integrate the front-end. It’s possible to customize the buy buttons and the cart as much as we want, right? (add the cart to an existing , add the buy buttons to existing links…)

I am not sure to understand what you are trying to do, but yes now you have the power of Kirby and Shopify combined. You can add fields to your products blueprint if you copy the one I made in the plugin to your personal blueprint folder.

Hello again @tristantbg !

I have a question about Shopify product variants in the plugin. The product blueprint in the panel has a structure for variants with 4 columns: price, compare at price, inventory quantity and SKU. Is there any way to retrieve the names of the variants so that they can be visible in the panel as well?

Thanks again for making such a helpful plugin :smile:

Hey @Jac733 !

The last release include a variant title in the blueprints :

You can also create your own shopify.product.yml file in your blueprints to override the file of the plugin !

That’s perfect @tristantbg, thanks a lot! If changing the blueprint is all that’s needed, does that mean I could add a “collection” field as well, to display the collection that the product belongs to?

Edit: I’ve tried to make a new field called collections , along with adding 'collections' => $product['collections'], in the shopify.products.php model - this was a bit of a wild guess, because I cannot see the link between some of these properties and the ones listed in the Storefront API docs. Anyways it didn’t work, obviously :stuck_out_tongue:

I don’t think you can do this this way…

An easy way would be to add a section with this plugin :

    headline: Featured in these collections
    type: pagesdisplay
    query: kirby.collection("kirby-shopify.collections").filterBy("hasProduct", page.shopifyID)

With a custom method page :

function hasProduct($shopifyID) {
    return $this->find($shopifyID);

Ah, that’s unfortunate… I was hoping to bypass the “collections” part of the plugin, since it only fetches collections that are automated, and not created manually (and this client created all the collections manually).

In the product page on the shopify website, there is a field that shows the collections the product is in, and then this is shown in the product Storefront API reference :

(this is in the same table as “variants” which is successfully accessed by your plugin)

and then we see this is in the “collection” reference:

which really makes it seem like we should be able to access the list of collections directly from the product…

Can I ask where you got the names of all these fields from? Are they a reference directly to the data returned by Shopify, or did you define them somewhere else?

I ask because some of them don’t match the field names shown here, so I’m wondering if there’s a list of all the available data that can be accessed like this.

Sorry again for bothering you so much @tristantbg , in the worst case I’ll just let them manually fill a “Collection” field directly in the product page :smile:

Hi @Jac733,

I am sorry but getting manual sorted collections is not possible yet.

If you feel to rewrite the plug-in using GraphQL, this would solve the problem :sweat_smile:

As soon as I have some free time I’ll deal with this issue.

No problem! I’m not trying to rewrite anything, I’m just trying to add one field that normally exists - I just can’t find the right name…

All I need is a list of the data that can be accessed with $product['xxxxx']. I’ll do some digging in the plugin and see what I find.

Thanks again for your hard work :slight_smile:

Edit: I still can’t find where you defined all of these. The names have to come from somewhere, right? Is there a reference other than the one I linked above?

Hi! Thanks for your plugin @tristantbg !

I’m thinking about using it in a project but wondering how it actually looks like in the panel.
Is it fetching the Shopify data and creating an “all fields read-only” page for each product or am I misunderstanding?

I don’t want to be rude but I can’t try it out at the moment – maybe someone can post a screenshot on how it looks in the panel, that would be very very nice! Sorry!

Here you go :


Hi @tristantbg ! Is it possible to add regular fields to a product page like in your screenshot?
I quickly tried adding a field to the blueprint file in the plugin folder, however it’s always empty after reloading the page.

The idea is to have additional content/files be displayed on a product page alongside the standard Shopify fields like in your screenshot.


(Like the “Actual title” field in the screenshot)

Got it. Custom fields break on a multi-language-setup because the multi-language-setup adds the according language code to the shopify.product.txt file.

Do you have any intentions to maybe support multi-language-setups @tristantbg ?

Hi @Tobias_L and @tristantbg ! I am facing a similar problem and I don’t have a multi language setup. My custom fields are updated on the shopify.product.txt but they are empty on page reload and I can’t fetch the fields from the product template. Do you have a solution ?

I tried to find where the problem was and I noted that $kirbyProductRoot in shopify.product.php is not pointing to the shopify.product.txt of the product, maybe it’s there ?

Hi @gautierb!

Did you find a solution for your problem, I noticed once in a while the custom fields are empty again. Don’t know the reason though :confused:

It would be kind of unproductive if a client populates all the custom fields of multiple products and once in a while all of the content would be gone.

@tristantbg Is there a pattern on how often the whole cache gets emptied/rebuild?
(And thus also the custom fields get emptied.)



Do you use the last version of the plugin ?
In an older version, the $page->num() of product pages was the index retrieved by the shopify fetch.
This index changes depending on the order of the products of Shopify so it breaks the folder name structure of kirby and it breaks the custom fields.
What I did later was to use the Shopify ID of the product as a $page->num() instead to prevent that.

If you look in your content folder and have many times a folder with the same product handle, it might be because of that :confused:

Hope this helps.

Hi @tristantbg, thanks!

I’ll download the latest version!