Closed davidpaulsson closed 3 years ago
I would pass false
to shouldWrapRootElementWithProvider
(docs link). From there, you can set up your own context provider that conditionally provides the right access token/info.
Example:
import React from 'react';
import {ContextProvider} from 'gatsby-theme-shopify-manager';
export function StoreWrapper = ({children}) => {
const shopName = {
us: 'some-US-shop-name',
eu: 'some-EU-shop-name',
};
const accessToken = {
us: 'some-US-token',
eu: 'some-EU-token',
};
return (
<ContextProvider shopName={shopName[currentLocation]} accessToken={accessToken[currentLocation]}>
{children}
</ContextProvider>
);
};
I think this will work, but I've never tried something like this. Best of luck.
@thetrevorharmon Thank you!
First off: thanks for a great plugin!
I'm wondering what's the best approach would be to build a regionalized gatsby site that connects to different Shopify stores? My company currently have different Shopify stores for different regions, like one Shopify store for US, one for EU, one for Canada etc.
I'm trying to figure out the architecture for this to have
mysite.com/en-eu/:splat
,mysite.com/en-us/:splat
, andmysite.com/en-ca/:splat
, etc, and haveuseCart
(as an example) connect to the different Shopify stores based on a regional setting. Is it possible to somehow have multiple versions of gatsby-theme-shopify-manager running at once?