Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Generating feeds for Google Merchant Center or Facebook catalogs in Shopify

31 replies
Last updated: Jan 7, 2023
I asked this is the Shopify channel, but thought I’d add here as well. I’m curious how others are generating feeds for Google Merchant Center or Facebook catalogs. Our URLs won’t match what would come out of the native sales channels. Are you using Shopify apps like DataFeedWatch, a custom csv using json2csv, or something else? Thanks in advance.
Jan 7, 2023, 1:21 AM
what do you mean the urls won’t match?
Jan 7, 2023, 1:33 AM
Sorry. The url structure of our site won’t match what’s in Shopify. In shopify a product is at /products/product-slug but in our Gatsby site the urls are /shop/product-slug.
Jan 7, 2023, 1:35 AM
do you not have a redirect in your shopify theme?
Jan 7, 2023, 1:36 AM
and why didn’t you follow the traditional pattern, wouldn’t it make more sense to more closely match what’s expected of shopify and just resolve it that way?
Jan 7, 2023, 1:36 AM
Not yet. We’re using Shopify for the account and that will be at account.domain.com , but our main site is just at domain.com .
Jan 7, 2023, 1:36 AM
right you can have the redirects skip everything but accounts
Jan 7, 2023, 1:37 AM
That’s a good question. We did it to better match the old site url structure to help with redirects. But we can easily change it to better match Shopify.
Jan 7, 2023, 1:37 AM

     <script>
      var l = window.location
      /**
       * allow app urls to pass through
       */
      if (/^\/a\//.test(l.pathname)) {
        // do nothing
      } else {    
        var href = '<http://midway-starter.netlify.com|midway-starter.netlify.com>'
        if (l.pathname) href += '/' + l.pathname
        if (l.hash) href += l.hash
        if (l.search) href += l.search
        href = href.replace('//', '/')
        window.top.location.href = 'https://' + href
      }
    </script>
Jan 7, 2023, 1:37 AM
if you followed the traditional pattern this would do exactly what you need
Jan 7, 2023, 1:38 AM
you could paste that in the theme.liquid and accounts would still work but everything else redirects
Jan 7, 2023, 1:38 AM
wow, awesome. Then we can just use the regular sales channels?
Jan 7, 2023, 1:38 AM
you could refactor it to redirect to /shop too pretty easily
Jan 7, 2023, 1:38 AM
the first headache i learned about shopify headless was to follow their url structure for products
Jan 7, 2023, 1:39 AM
makes your life easier
Jan 7, 2023, 1:39 AM
right. makes sense. The redirects within the theme is new to me.
Jan 7, 2023, 1:39 AM
shopify is working on redirects at the sales channel level, they do that for hydrgeon already
Jan 7, 2023, 1:39 AM
but it’s not for all headless yet
Jan 7, 2023, 1:39 AM
Would you suggest doing the same for collections? Seems less of an issue.
Jan 7, 2023, 1:39 AM
um you can, but i honestly never use shopify collections
Jan 7, 2023, 1:39 AM
i have clients manage collection generation in sanity
Jan 7, 2023, 1:40 AM
yeah we didn’t do that for this build but I’m starting to see some advantages of that approach.
Jan 7, 2023, 1:40 AM
my clients always want editorialized content inside collections and i don’t like the sanity-shopify starter approach that just yolo throws them into the mix
Jan 7, 2023, 1:40 AM
so you prefer the Sanity Connect?
Jan 7, 2023, 1:42 AM
in the starter they let you add editorial content but without placing/setting where it would show up
Jan 7, 2023, 1:42 AM
because it doesn’t map the shopify product array into collections
Jan 7, 2023, 1:42 AM
because they change too often (since some shopify collections have really specific merchandising patterns)
Jan 7, 2023, 1:42 AM
gets complicated
Jan 7, 2023, 1:43 AM
right makes sense
Jan 7, 2023, 1:43 AM
thanks for you help Kevin! Mind if I dm you if I have other questions is the future?
Jan 7, 2023, 1:44 AM
probably prefer it kept in public, i was actually gonna answer you earlier and i had other things come up 😂
Jan 7, 2023, 1:45 AM
All good. Thanks again.
Jan 7, 2023, 1:45 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?