Skip to content

Allow changing useLegacyShippingZoneStockAvailability shop settings#6536

Merged
lkostrowski merged 6 commits intomainfrom
allow-changing-legacy-stock-availability-flag
Apr 27, 2026
Merged

Allow changing useLegacyShippingZoneStockAvailability shop settings#6536
lkostrowski merged 6 commits intomainfrom
allow-changing-legacy-stock-availability-flag

Conversation

@IKarbowiak
Copy link
Copy Markdown
Member

Scope of the change

Allow changing shop.useLegacyShippingZoneStockAvailability setting

image
  • I confirm I added ripples for changes (see src/ripples) or my feature doesn't contain any user-facing changes
  • I used analytics "trackEvent" for important events

@IKarbowiak IKarbowiak self-assigned this Apr 23, 2026
@IKarbowiak IKarbowiak requested review from a team, Copilot and wcislo-saleor April 23, 2026 10:09
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

🦋 Changeset detected

Latest commit: b59dff0

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.16%. Comparing base (71222e4) to head (b59dff0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...s/components/SiteSettingsPage/SiteSettingsPage.tsx 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6536      +/-   ##
==========================================
- Coverage   48.17%   48.16%   -0.01%     
==========================================
  Files        2589     2589              
  Lines       46043    46049       +6     
  Branches    10868    10586     -282     
==========================================
  Hits        22181    22181              
- Misses      22617    23489     +872     
+ Partials     1245      379     -866     
Flag Coverage Δ
storybook 43.85% <ø> (ø)
units 43.82% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UI + GraphQL wiring to allow changing the shop.useLegacyShippingZoneStockAvailability setting from the Site Settings area.

Changes:

  • Extends shop GraphQL fragment/codegen to include useLegacyShippingZoneStockAvailability.
  • Adds a new “Stock availability” section with a checkbox to toggle the setting.
  • Includes the setting in the shop settings update input mapping and fixtures.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/siteSettings/views/index.tsx Sends useLegacyShippingZoneStockAvailability in ShopSettingsInput on save.
src/siteSettings/fixtures.ts Updates site settings fixture shop object with the new field.
src/siteSettings/components/SiteSettingsPage/messages.ts Adds i18n messages for the new Stock availability section.
src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx Renders the new section + checkbox (and webhook info list).
src/graphql/types.generated.ts Regenerates types to include the new shop field in fragments/queries/mutations.
src/graphql/hooks.generated.ts Updates generated Shop fragment document to query the new field.
src/fragments/shop.ts Adds the field to the Shop GraphQL fragment.
locale/defaultMessages.json Adds default message catalog entries for the new i18n strings.

Comment thread locale/defaultMessages.json Outdated
Comment on lines +10030 to +10034
"stockAvailabilityDesc": {
"context": "section description",
"string": "When enabled, stock availability is filtered by shipping zones and the destination address (legacy behavior). When disabled, it is determined only by the direct warehouse-channel link."
},
"stockAvailabilityWebhooks": {
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultMessages.json adds entries under keys stockAvailabilityDesc and stockAvailabilityWebhooks, but the corresponding defineMessages IDs are 6LdQvx and wmybDi. This will prevent those strings from being picked up/translated correctly (and leaves two unused keys in the messages catalog). Update the JSON keys to match the message IDs (or update the message IDs to match), keeping the catalog consistent with the rest of the file.

Suggested change
"stockAvailabilityDesc": {
"context": "section description",
"string": "When enabled, stock availability is filtered by shipping zones and the destination address (legacy behavior). When disabled, it is determined only by the direct warehouse-channel link."
},
"stockAvailabilityWebhooks": {
"6LdQvx": {
"context": "section description",
"string": "When enabled, stock availability is filtered by shipping zones and the destination address (legacy behavior). When disabled, it is determined only by the direct warehouse-channel link."
},
"wmybDi": {

Copilot uses AI. Check for mistakes.
Comment on lines +292 to +303
<Box display="flex" flexDirection="column" gap={1}>
<Text size={2} color="default2">
{intl.formatMessage(messages.sectionStockAvailabilityWebhooksIntro)}
</Text>
<Box as="ul" margin={0} paddingLeft={5}>
{stockAvailabilityWebhooks.map(name => (
<Box as="li" key={name}>
<Text size={2}>{name}</Text>
</Box>
))}
</Box>
</Box>
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy says these webhooks become available when the setting is disabled, but the intro + list are always rendered regardless of useLegacyShippingZoneStockAvailability. This is misleading in the enabled state; consider rendering the intro/list only when !data.useLegacyShippingZoneStockAvailability (or adjust the copy so it matches the always-visible behavior).

Suggested change
<Box display="flex" flexDirection="column" gap={1}>
<Text size={2} color="default2">
{intl.formatMessage(messages.sectionStockAvailabilityWebhooksIntro)}
</Text>
<Box as="ul" margin={0} paddingLeft={5}>
{stockAvailabilityWebhooks.map(name => (
<Box as="li" key={name}>
<Text size={2}>{name}</Text>
</Box>
))}
</Box>
</Box>
{!data.useLegacyShippingZoneStockAvailability && (
<Box display="flex" flexDirection="column" gap={1}>
<Text size={2} color="default2">
{intl.formatMessage(messages.sectionStockAvailabilityWebhooksIntro)}
</Text>
<Box as="ul" margin={0} paddingLeft={5}>
{stockAvailabilityWebhooks.map(name => (
<Box as="li" key={name}>
<Text size={2}>{name}</Text>
</Box>
))}
</Box>
</Box>
)}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the propose changes. Current approach just adds extra info that extra webhooks will be available when the flag is disabled.

wcislo-saleor
wcislo-saleor previously approved these changes Apr 23, 2026
@IKarbowiak IKarbowiak requested a review from lkostrowski April 23, 2026 10:36
lkostrowski
lkostrowski previously approved these changes Apr 24, 2026
Comment thread locale/defaultMessages.json Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 09:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

},
sectionStockAvailabilityWebhooksIntro: {
id: "wmybDi",
defaultMessage: "When disabled, the following channel-scoped stock webhooks become available:",
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intro copy says these webhooks “become available” when the setting is disabled, but the Dashboard already lists all async webhook event types unconditionally (e.g. WebhookDetailsPage builds its event list from Object.keys(WebhookEventTypeAsyncEnum)). This makes “available” misleading; consider rewording to reflect that the events are only triggered/fired when the setting is disabled (as described in the GraphQL schema docs), rather than implying they cannot be selected/used otherwise.

Suggested change
defaultMessage: "When disabled, the following channel-scoped stock webhooks become available:",
defaultMessage: "When disabled, the following channel-scoped stock webhooks are triggered:",

Copilot uses AI. Check for mistakes.
@IKarbowiak IKarbowiak dismissed stale reviews from lkostrowski and wcislo-saleor via 9c777e5 April 24, 2026 09:56
@IKarbowiak IKarbowiak requested a review from lkostrowski April 24, 2026 10:02
Copilot AI review requested due to automatic review settings April 27, 2026 13:46
@lkostrowski lkostrowski enabled auto-merge (squash) April 27, 2026 13:47
@lkostrowski lkostrowski merged commit 15eced3 into main Apr 27, 2026
17 of 20 checks passed
@lkostrowski lkostrowski deleted the allow-changing-legacy-stock-availability-flag branch April 27, 2026 13:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines +316 to +320
{stockAvailabilityWebhooks.map(name => (
<Box as="li" key={name}>
<Text size={2}>{name}</Text>
</Box>
))}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The webhook event types are rendered directly from WebhookEventTypeAsyncEnum (e.g. PRODUCT_VARIANT_OUT_OF_STOCK_IN_CHANNEL), which will show up as all-caps with underscores in the UI. Consider formatting these values into a human-readable label (replace _ with spaces, lowercase + capitalize) or reusing the formatting approach used in the webhook events UI so this section is readable for non-technical users.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants