Skip to content

Adding in types for purchaseType and recurringCycleLimit fields#4275

Open
owenhuang88 wants to merge 2 commits into2026-04from
discountSubscriptionFieldsUI
Open

Adding in types for purchaseType and recurringCycleLimit fields#4275
owenhuang88 wants to merge 2 commits into2026-04from
discountSubscriptionFieldsUI

Conversation

@owenhuang88
Copy link
Copy Markdown
Contributor

@owenhuang88 owenhuang88 commented Apr 8, 2026

Add purchaseType and recurringCycleLimit to DiscountsApi

Background

Follow-up to the admin-web changes in https://github.com/shop/world/pull/411309 and https://github.com/shop/world/pull/411407, which add support for purchase type and recurring cycle limit fields in the discounts plugin.

This PR adds the corresponding types to @shopify/ui-extensions so that discount function settings extensions have access to these new fields in their type contract.

Part of this release plan: https://docs.google.com/document/d/1cchvYA3UEDO2o651f_FgsdRqkBSRJLBO3Ac-EAMGCb8/edit?tab=t.0#heading=h.3twiyx2rdsvm

Changes

  • Added PurchaseType type ('one_time_purchase' | 'subscription' | 'both')
  • Added purchaseType / updatePurchaseType signals to DiscountsApi
  • Added recurringCycleLimit / updateRecurringCycleLimit signals to DiscountsApi
  • Added discounts definition to the doc schema (pre-existing gap)

References

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

🚨🚨🚨 Docs migration in progress 🚨🚨🚨

We are actively migrating UI extension reference docs to MDX in the areas/platforms/shopify-dev zone of the monorepo. This impacts docs for the following surfaces:

During this migration, please be aware of the following:

.doc.ts files are being deprecated. Changes to .doc.ts files in this repo will not be reflected in the new MDX-based docs. If you need to update docs for a reference that has already been migrated, make your changes directly in the areas/platforms/shopify-dev zone of the monorepo instead.

Doc comments in .ts source files (the comment blocks above types and functions) are also affected. Generating docs from these comments currently requires a newer version of the @shopify/generate-docs library that isn't yet available. Updates to doc comments may not produce the expected output until the migration is complete.

Examples that previously lived in this repo are being moved to the areas/platforms/shopify-dev zone of the monorepo and should be authored there going forward.

What should I do?

  • If your PR includes changes to .doc.ts files, doc comments, or examples, please reach out to us in #devtools-proj-templated-refs so we can help ensure your updates are captured correctly.
  • If your PR is limited to source code changes (non-docs), you can ignore this notice.

Thanks for your patience while we complete the migration! 🙏

Copy link
Copy Markdown
Contributor Author

owenhuang88 commented Apr 8, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@owenhuang88 owenhuang88 changed the title Added in subscription fields Adding in types for purchaseType and recurringCycleLimit fields Apr 8, 2026
@owenhuang88 owenhuang88 marked this pull request as ready for review April 8, 2026 17:32
@owenhuang88 owenhuang88 requested a review from devisscher April 8, 2026 18:26
Copy link
Copy Markdown
Contributor

@devisscher devisscher left a comment

Choose a reason for hiding this comment

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

Nice! This looks good to me. For @vividviolet, we were thinking of adding this as a patch. Owen mentioned this is ok. So we'll put it on 2026-04 branch and do we need to do anything for releasing the new patch?

Copy link
Copy Markdown
Member

@vividviolet vividviolet left a comment

Choose a reason for hiding this comment

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

A few things you need to do:

  • You need to rebase the branch on 2026-04 since the stable release already went out.
  • After the PR is merged to the stable branch
    • Approve and merge the Versions PR that automatically gets created to do a patch release
    • Run the docs:sync command to create a PR to update the docs on shopify.dev

Comment thread .changeset/add-purchase-type-and-recurring-cycle-limit.md Outdated
applyMetafieldChange: () => ({type: 'success'}),
updateDiscountClasses: () => ({success: true as const, value: []}),
updatePurchaseType: () => ({
success: true as const,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this hardcoded to true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just for testing convenience with the factory, and following discount classes :)

@owenhuang88 owenhuang88 force-pushed the discountSubscriptionFieldsUI branch from 4db0086 to 19df3d1 Compare April 22, 2026 21:30
@owenhuang88 owenhuang88 changed the base branch from 2026-04-rc to 2026-04 April 22, 2026 21:30
Stable 2026-04 release has shipped, so new fields ship as a patch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

3 participants