From d8821f85f5313b9326f9c2cbfe33e3e854e48bd2 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 1 Mar 2023 23:13:45 +0100 Subject: [PATCH] Fix discount route (#601) * Fix discount route * Changeset --- .changeset/tall-falcons-punch.md | 5 +++++ packages/cli/src/utils/missing-routes.ts | 2 +- packages/hydrogen/src/seo/generate-seo-tags.test.ts | 2 +- .../($lang)/{discounts.$code.tsx => discount.$code.tsx} | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/tall-falcons-punch.md rename templates/demo-store/app/routes/($lang)/{discounts.$code.tsx => discount.$code.tsx} (97%) diff --git a/.changeset/tall-falcons-punch.md b/.changeset/tall-falcons-punch.md new file mode 100644 index 0000000000..46755e3823 --- /dev/null +++ b/.changeset/tall-falcons-punch.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-hydrogen': patch +--- + +Fix `check routes` command to correctly check the standard route `/discount/` instead of `/discounts/`. diff --git a/packages/cli/src/utils/missing-routes.ts b/packages/cli/src/utils/missing-routes.ts index 60ed4d25b5..95e09e9ace 100644 --- a/packages/cli/src/utils/missing-routes.ts +++ b/packages/cli/src/utils/missing-routes.ts @@ -26,7 +26,7 @@ const REQUIRED_ROUTES = [ // 'variants/:variantId', 'search', // 'gift_cards/:storeId/:cardId', - 'discounts/:discountCode', + 'discount/:discountCode', 'account', 'account/login', diff --git a/packages/hydrogen/src/seo/generate-seo-tags.test.ts b/packages/hydrogen/src/seo/generate-seo-tags.test.ts index 23c02aaa53..0e96377557 100644 --- a/packages/hydrogen/src/seo/generate-seo-tags.test.ts +++ b/packages/hydrogen/src/seo/generate-seo-tags.test.ts @@ -656,7 +656,7 @@ describe('generateSeoTags', () => { offers: [ { '@type': 'Offer', - url: 'hydrogen.shop/discounts/1234', + url: 'hydrogen.shop/discount/1234', }, ], }, diff --git a/templates/demo-store/app/routes/($lang)/discounts.$code.tsx b/templates/demo-store/app/routes/($lang)/discount.$code.tsx similarity index 97% rename from templates/demo-store/app/routes/($lang)/discounts.$code.tsx rename to templates/demo-store/app/routes/($lang)/discount.$code.tsx index 929611fb78..52cb7b4851 100644 --- a/templates/demo-store/app/routes/($lang)/discounts.$code.tsx +++ b/templates/demo-store/app/routes/($lang)/discount.$code.tsx @@ -8,7 +8,7 @@ import {cartCreate, cartDiscountCodesUpdate} from './cart'; * @example * Example path applying a discount and redirecting * ```ts - * /discounts/FREESHIPPING?redirect=/products + * /discount/FREESHIPPING?redirect=/products * * ``` * @preserve