From 5f3449b871d64787eddfdd0309193bc114ec1384 Mon Sep 17 00:00:00 2001 From: Daniel Lew <51924260+DanielSLew@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:59:57 -0400 Subject: [PATCH] feat(gatsby-source-shopify): add default sales channel when using shopify app integration (#32010) * add default sales channel when using shopify app integration * set default salesChannel during schema initialization (cherry picked from commit 95280a38fc410838c724ed6c6e3facf5dbbaf4c1) --- packages/gatsby-source-shopify/README.md | 2 ++ packages/gatsby-source-shopify/src/gatsby-node.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-shopify/README.md b/packages/gatsby-source-shopify/README.md index 5bfd05737fcb5..a1b13b1d6ddef 100644 --- a/packages/gatsby-source-shopify/README.md +++ b/packages/gatsby-source-shopify/README.md @@ -163,6 +163,8 @@ Not set by default. If set to a string (example `MyStore`) node names will be `a Not set by default. If set to a string (example `My Sales Channel`), only products and collections that are active in that channel will be sourced. If no sales channel is provided, the default behavior is to source products that are available in the online store. +Note: If you set up your site with the Gatsby Cloud Public App integration, `salesChannel` is set for you. +
## Images diff --git a/packages/gatsby-source-shopify/src/gatsby-node.ts b/packages/gatsby-source-shopify/src/gatsby-node.ts index cd71b6233364f..b088799c052b5 100644 --- a/packages/gatsby-source-shopify/src/gatsby-node.ts +++ b/packages/gatsby-source-shopify/src/gatsby-node.ts @@ -43,7 +43,9 @@ export function pluginOptionsSchema({ shopifyConnections: Joi.array() .default([]) .items(Joi.string().valid(`orders`, `collections`)), - salesChannel: Joi.string(), + salesChannel: Joi.string().default( + process.env.GATSBY_SHOPIFY_SALES_CHANNEL + ), }) }