-
Notifications
You must be signed in to change notification settings - Fork 345
feat(core): add toggle for newsletter in account settings #2789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 73458dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
b525ef5 to
d17b4fc
Compare
d17b4fc to
a556726
Compare
a556726 to
5149f72
Compare
5149f72 to
ba9cb17
Compare
ba9cb17 to
be149d6
Compare
be149d6 to
adb2bb3
Compare
adb2bb3 to
4986452
Compare
4986452 to
23832fa
Compare
23832fa to
535ade3
Compare
535ade3 to
cb61ae3
Compare
migueloller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
4ada4ae to
afdd3d1
Compare
afdd3d1 to
c34fa5f
Compare
jordanarldt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What/Why?
Add newsletter subscription toggle to account settings page, allowing customers to manage their marketing preferences directly from their account.
What Changed
NewsletterSubscriptionFormcomponent with a toggle switch for subscribing/unsubscribing to newslettersupdateNewsletterSubscriptionserver action that handles both subscribe and unsubscribe operations via BigCommerce GraphQL APIAccountSettingsSectionto conditionally display the newsletter subscription form when enabledCustomerSettingsQueryto fetchisSubscribedToNewsletterstatus andshowNewsletterSignupstore settingAccount.Settings.NewsletterSubscriptionnamespaceTesting
Locally and added end to end tests.
Kapture.2025-12-22.at.12.02.52.mp4
Migration
To add the newsletter subscription toggle to your account settings page:
Step 1: Copy the server action
Copy the new server action file to your account settings directory:
Step 2: Update the GraphQL query
Update
core/app/[locale]/(default)/account/settings/page-data.tsxto include newsletter subscription fields:Also update the return statement to include
newsletterSettings:Step 3: Copy the NewsletterSubscriptionForm component
Copy the new form component:
Step 4: Update AccountSettingsSection
Update
core/vibes/soul/sections/account-settings/index.tsx:Step 5: Update the account settings page
Update
core/app/[locale]/(default)/account/settings/page.tsx:AccountSettingsSection:Step 6: Add translation keys
Add the following keys to your locale files (e.g.,
messages/en.json):{ "Account": { "Settings": { ... "NewsletterSubscription": { "title": "Marketing preferences", "label": "Opt-in to receive emails about new products and promotions.", "marketingPreferencesUpdated": "Marketing preferences have been updated successfully!", "somethingWentWrong": "Something went wrong. Please try again later." } } } }Step 7: Verify the feature
/account/settingsas a logged-in customerThe newsletter subscription form will only display if
newsletterSubscriptionEnabledistrue(controlled by theshowNewsletterSignupstore setting).