How to Integrate Shopify into your Strapi Website

Shopify is a subscription service that lets you create, manage and sell your products or services. When combined with Strapi and its ability to customize and manage content, you have on your hands a sleek, powerful website or app that is both attractive to your customers and very easy to use.


This is a companion discussion topic for the original entry at https://strapi.io/blog/integrate-shopify-into-your-strapi-website

I was able to follow the tutorial without getting any error messages. However, I’m totally lost with regard to the following: I created a product in Strapi and I created a product in Shopify. When I paste the URL http://localhost:1337/products/1 I get the expected response. What is not obvious in this blog post is that the response has two sections: On the top information from Strapi and further down information from Shopify.

Now, what has happened is that I have created two separate entries of the product: one in Strapi and one in Shopify, but I fail to see any meaningful integration here. Instead, there are two parallel responses. However, the purpose of integration would be to be able to enter the information of a product either in Shopify or in Strapi (preferably Strapi), and then the information would be automatically shared and accessed in the other end. Now I’m only making double work by creating two parallel instances of the product with overlapping fields, which is meaningless.

So what would be a meaningful way to benefit from Strapis capability to get information from Shopify through the API? Could the information from Shopify be made visible in Strapi’s Admin Panel?
Also, how could this integration be made to work the other way around, i.e. data would be entered in Strapi and be visible in Sopify. This would clearly require a separate tutorial.

Please advise me.

Hi @mnyman
Thank you so much for your feedback.

I’m currently working on integrating Strapi and Shopify so that a user will create products on Shopify, and it’ll automatically show up on Strapi.

Alternatively, a user will create on Strapi, and it’ll automatically show up on Shopify.

The article will also demonstrate how to make updates to the product from either only Strapi or only Shopify.

Please be patient while you wait for the article to be updated. It’s currently in its research and development stage.

There’s a good chance it will be available by the time Strapi v4 is ready so that it’ll also include updates specific to v4.

Have a wonderful day :hugs:
Also congrats on following the current tutorial without getting any error messages :partying_face: :tada:

how to get all products from shopify?
tried the following but getting empty array

async find(ctx) {
let entities;
if (ctx.query._q) {
entities = await strapi.services.product.search(ctx.query);
} else {
entities = await strapi.services.product.find(ctx.query);
}

return entities.map(async (entity) => {
  entity.shopify = await shopify.product.get(entity.shopifyID);

  return sanitizeEntity(entity, { model: strapi.models.product });
});

}

I do find it quite bizarre we have to create products on both Shopify AND Strapi and manually link them with an ID. It feels like a step back, and defeats the object os using a single headless CMS like Strapi.

Are there no eCommerce solutions that do not need a second database of matching products created in the system? An eCommerce system that can be used for a cart built entirely from Strapi products, an no need to manually match them to another database of products?

Or is there no sync process to auto create/update/delete products on Shopify?

2 Likes

Thanks for this article. I believe it is exactly what I need.

We are in a situation where we have a warehouse system that pushes products to Shopify but products are not updated in this system if changed in Shopify. Because of this editing existing information on products in Strapi is not an option, but we still want to add information to each product.

So I am thinking about setting up webhooks in Shopify that pushes new / updates existing / deletes products in Strapi (using only the ID and title).

I would assume that a custom controller can handle this, and if you need all fields, just add the fields to Strapi that you want created / updated by this webhook.

That’s a good idea, thanks. Every business owner should try Integrating Shopify into their Strapi website. By combining the customization and content management abilities of Strap with the e-commerce features of Shopify, you can create a user-friendly website or app that attracts customers.

Also, there’s a cool feature of advanced shipping rules shopify, which helps me regulate the restrictions when shipping. I hope it’s helpful to you guys.