good-idea / sane-shopify

MIT License
212 stars 15 forks source link

[WIP] feature(repo): accept multi-store configuration #157

Closed liqueflies closed 3 years ago

liqueflies commented 3 years ago

Hello!

after some work I am going to submit you this first review for sane-shopify multistore!

As you said in #147, the most important thing where keep the store with already synched stores and migrate. Also sync storeName indie document.

I came up with this solution in that way:

What's missing?

basically webhook. I am going to ask your check for the rest and help me with that.

I leave here some screenshot but of course I suggest you to download my branch linking into a project of yours :)

Hope this can be a good news to you 🎉

Screenshot 2021-03-25 at 10 21 13

Screenshot 2021-03-25 at 10 20 39

Screenshot 2021-03-25 at 10 20 59

Screenshot 2021-03-24 at 18 39 03

liqueflies commented 3 years ago

UPDATE: I saw you made a fix in syncState that I also made but your way was better, so I rebased with your main

liqueflies commented 3 years ago

UPDATE 2: checking now for webhook you are going to setup your implementation of webhook so you are providing already the correct secrets for shopify

good-idea commented 3 years ago

I think it would also be good to add a disclaimer about adding multiple storefronts - and provide a link to a section of the docs here about caveats when working with multiple storefronts. Essentially, that they will need to handle their own logic for multiple carts.

I'm imagining a scenario where I want to create a "popup" site, selling products made by my friends - where all products are displayed on the website. Just thinking out loud here..

liqueflies commented 3 years ago

I think it would also be good to add a disclaimer about adding multiple storefronts - and provide a link to a section of the docs here about caveats when working with multiple storefronts. Essentially, that they will need to handle their own logic for multiple carts.

I'm imagining a scenario where I want to create a "popup" site, selling products made by my friends - where all products are displayed on the website. Just thinking out loud here..

In my particular case I was able to handle multiple listing based on location (https://www.shopify.com/plus/solutions/international-ecommerce)

So what've done is having all countries in a singular sanity instance. I've made a document called region (US, EU, ROW) for example.

Example:

on document fields add:

  {
    type: 'reference',
    name: 'region',
    title: 'Display in',
    // hidden: true,
    to: [{ type: 'region' }]
  }

Than in desk structure I filter document from references on that region (https://www.sanity.io/docs/dynamically-group-list-items-with-a-groq-filter)

Talking about storefront I have to came up with different websites for each region: eu.mystore.com us.mystore.com row.mystore.com

I came up using the same codebase for each website with an ENV variable region (EU, US, ROW) and I make queries using the reference on documents and shopify storefront and token specific for each website.

So each website has it's storefront shopify keys and different cart, the code from frontend is the same!

liqueflies commented 3 years ago

Can I do something different for this?

good-idea commented 3 years ago

Added a couple things and published this in another branch because I didn't know I could push to forked repo branches!

Thank you for all of your work on this!