## Fix: Coupon Popup themes not applying their default content (themes 8 / 11 / 12 / 13) - #152
Open
ShahrearMSf wants to merge 2 commits into
Open
## Fix: Coupon Popup themes not applying their default content (themes 8 / 11 / 12 / 13)#152ShahrearMSf wants to merge 2 commits into
ShahrearMSf wants to merge 2 commits into
Conversation
- Correct Popup type default_theme to the prefixed key popup_notification_theme-one (the unprefixed 'popup_theme-one' matched no registered theme, leaving the initial theme invalid and breaking default application for rules-gated fields) - Drop conflicting field-level defaults on popup_subtitle and popup_coupon_code that pre-filled the fields and blocked each theme's own defaults - Apply the selected theme's defaults to empty fields at save and preview so coupon themes (eleven/twelve/thirteen) render as designed in Add New, Quick Builder, live Preview and on the front end (subtitle, coupon code, tickets)
ShahrearMSf
added a commit
that referenced
this pull request
Aug 3, 2026
…ree release
Pre-release integration of three NotificationX Free candidates onto nx-dev
(branched from nx-dev, which was even with master) so the combined result can be
built and tested before the individual PRs merge to master. No version bump.
Cards / candidates
------------------
- 81117 BitIntegrations: unify $module ('modules_bitintegrations') and title
across BitIntegrationsConversions / EmailSubscription / Reviews (and the
module list in Types/Conversions + OfferAnnouncement) so the builder
renders ONE "Bit Integrations" source section instead of two. Fix the
doc links (bit-integrations-notification-alert, configure-discount-alert)
- both resolve HTTP 200.
- 2318 (PR #152) Coupon Popup: themes 8/11/12/13 now apply their own default
content on a default/untouched publish - subtitle, coupon code, and the
theme-thirteen coupon tickets. Fixes the Popup type default_theme key,
drops conflicting field-level defaults, and fills empty theme fields via
save_post + preview_settings.
- 78650 (PR #153) Targeting: country + user-role targeting (incl. a Guest /
logged-out option) for ALL notification types, decoupled from the bar
into Core\Targeting. Adds visitor-country geo-lookup caching
(request-level memo + per-IP transient + CDN header shortcut) so the
ip-api.com lookup no longer runs on every notification load.
Merge
-----
Merge order: nx-dev -> 81117 -> 2318 -> 78650. All feature code lives in disjoint
files (BitIntegrations vs Popup vs Targeting/Core), so there were no code
conflicts - only the shared translation template collided (see below).
POT file conflict fix
---------------------
languages/notificationx.pot was the only merge conflict, because every branch
regenerates it. Resolved by regenerating a fresh union with `npm run pot`
(wp i18n make-pot) so the template contains all three features' strings.
Zip build (standard dev way; node per .nvmrc = 16)
--------------------------------------------------
- nvm use 16 (node v16.20.2, npm 8.19.4)
- rm -rf node_modules/@wordpress/compose/node_modules \
node_modules/@wordpress/scripts/node_modules
# required: fixes "TS2786: 'Pagination' cannot be used as a JSX component"
# (duplicate @types/react nested under @wordpress/*)
- npm run build && npm run bb && npm run cd && npm run pot
- package honoring .distignore. `wp dist-archive .` needs wp-cli >= 2.13 and the
build machine has 2.11, so packaging used the equivalent
rsync --exclude-from=.distignore (identical file selection).
- artifact: notificationx-nx-dev-3.2.12.zip (Free 3.2.12)
Testing
-------
Installed the built zip on local with Pro 3.1.5 active (Free-new + Pro compat).
0 fatals; all three features working; country targeting also verified live on a
Cloudflare host. No PR and no merge to master.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a default (untouched) publish, the new Coupon Popup themes rendered incorrectly — the electronics (theme-twelve) and multi-tier (theme-thirteen) themes shipped with the wrong/empty subtitle, wrong coupon code, and missing coupon tickets, so the front end and the live builder Preview didn't match the design. This affected both Add New and Quick Builder. This PR fixes the theme-default application so every coupon theme renders as designed out of the box.
Reported issues
Root cause
Three compounding defects:
Types/Popup.phpdeclareddefault_theme = 'popup_theme-one', but theme keys are prefixed topopup_notification_theme-one. The initial theme was invalid.popup_subtitleandpopup_coupon_codecarried hardcoded field defaults ("Would like to get the latest news…","GET35OFF") that pre-filled the fields and blocked each theme's own defaults.popup_subtitle,popup_coupon_codeandpopup_coupon_repeaterare the only fields whoserulesexclude the initial theme, so they mount after the builder applies theme defaults and re-initialize to their field default — wiping the theme value. (Fields visible at the default theme, e.g. title/content, were unaffected — which is why only these fields broke.) theme-twelve savedGET35OFFinstead ofELEC 4512658; theme-thirteen lost its subtitle and saved a junk repeater row[{index, chosen, selected}](no tickets).The fix
includes/Types/Popup.php—default_theme→popup_notification_theme-one(fully-prefixed key).includes/Extensions/PopupNotification/PopupNotification.phppopup_subtitleandpopup_coupon_code.fill_theme_defaults()— fills only empty theme-specific fields from the selected theme'sdefaults(a repeater row containing only framework metadata counts as empty), so user-typed content is never overridden.save_post(persisted data + front end) andpreview_settings(live builder Preview). Both builders sharePostType::save_post, so Add New and Quick Builder are covered identically.Testing / verification
All from fresh, untouched publishes on this branch:
64%✅And Get Discount Now✅ELEC 4512658✅ (wasGET35OFF)#SAVE20/#SAVE40✅ (was junk)php -lclean on both changed files.cc @priyomukul bhai — please review before merge.