PLUGIN-ONLY FOLLOWUP — Next.js Editor 7.7.6 INSTALL THIS ZIP - Back up the existing plugin folder and WordPress database first. - Extract/merge into wp-content/plugins/ so the ZIP root nextjs-editor/ replaces the SAME existing folder. - Do not uninstall/delete the existing plugin or install a duplicate folder. - This followup changes ONLY the WordPress plugin. No Next.js source/env update or rebuild is needed for these new features, provided the previous shipping + coupon Next.js update is already installed. - Version 7.7.6 refreshes admin asset URLs. If old controls remain, hard-refresh the WordPress admin page. NEW FEATURES 1. The selected editor tab remains selected after Save All Changes and reload. AJAX saves also stay in the same tab. Quiz Editor remembers its own tab separately. 2. Coupon actions include an SVG Delete button with confirmation. Deletion moves the managed coupon to WordPress Trash; existing order records/history are not changed. 3. Both Create and Update forms include optional Start date and Expiry date. Blank dates mean no corresponding restriction. 4. Dates use the WordPress site's configured timezone. A coupon starts at 00:00 on its start date and expires at 23:59:59 on its expiry date. Same-day coupons are allowed. Expiry before start is rejected. 5. Date/status rules are enforced in both the existing headless coupon validation endpoint and native WooCommerce coupon validation. No new frontend endpoint is required. 6. Coupon list shows validity dates and Scheduled/Expired status alongside existing Active/Inactive status. DATA SAFETY - Existing settings, coupon amounts, min/max rules, usage data and order history are not reset by this update. - The Delete action is limited to this module's managed coupons. Unrelated WooCommerce coupons are not modified. - If WordPress Trash is disabled (EMPTY_TRASH_DAYS=0), Delete is refused to prevent permanent deletion; set the coupon Inactive instead. - Trash is not a permanent backup. WordPress may empty it according to its configured retention. Restore a trashed coupon from the native WordPress/WooCommerce Coupons Trash before that happens if necessary. - Older cached clients that omit date fields preserve existing date values. - Shipping, payment, tracking and Next.js files are not changed in this followup. VERIFICATION FOR THIS FOLLOWUP - PHP lint passed for all four PHP modules; admin JavaScript syntax check passed. - 16 coupon regression checks using real WooCommerce WC_Discounts with isolated WordPress/product stubs. - 25 coupon admin/backend checks with isolated WordPress/database stubs, including date boundaries, invalid dates, Trash protections and usage preservation. - 16 local admin browser checks with mocked AJAX and the actual PHP Save All redirect snippet. - 5 local Quiz tab browser checks with mocked AJAX/sortable. - Desktop/mobile coupon layouts reviewed; mobile fields checked to stay inside their card. - No live plugin installation, real WooCommerce database integration or real order was tested for this followup. POST-INSTALL QUICK CHECK - Open an editor tab, Save All Changes, confirm the same tab remains active. - Edit an existing coupon: confirm its amount/usage is unchanged and date fields are present. - Try a future-start/expired coupon at checkout: it should be rejected on Apply or final server validation. - Test Delete on a disposable coupon; confirm the code no longer applies and old orders remain unchanged. PREVIOUS SHIPPING + COUPON RELEASE NOTES (historical; steps below apply only if that earlier release has not yet been installed) -------------------------------------------------------------------------------- SHIPPING + COUPON UPDATE — based on supplied src v6 and Next.js Editor v11.2 ZIP IMPORTANT - This is a SOURCE update, not a compiled Next.js deployment. - Back up the deployed source/env files, WordPress plugin folder and WordPress database first. - This ZIP contains your supplied env values. Keep it private; do not commit env files to Git. - No package.json, lockfile, next.config, .htaccess or copy-static.js is replaced. - No new runtime npm dependency is required by these features. INSTALL ORDER 1. On WordPress, merge the plugin ZIP into wp-content/plugins/ so its root nextjs-editor/ replaces the SAME existing folder. Do not delete/uninstall the plugin; do not install a duplicate copy. 2. Open Next.js Editor once as an administrator. The Coupon tab and two defaults are initialized without overwriting existing coupons/settings. WooCommerce must be active. 3. Extract this Next.js ZIP into your EXISTING Next.js project root (the folder containing package.json). Root entries are src/, .env, .env.local and .env.production. Merge/replace; do not delete other project files. 4. Run your project's normal production build (normally npm run build), then your existing restart/deployment process. Continue using your existing copy-static/deployment steps where applicable. 5. Test a staging/test order before opening the coupon field on production. SHIPPING - Inside Dhaka: existing 70 BDT env rate. - Dhaka Sub Area: new 100 BDT env rate. - Outside Dhaka: existing 130 BDT env rate. - The existing 64-district list is unchanged. Savar is NOT inserted as a district. - Dhaka district -> Inside Dhaka; Gazipur/Narayanganj/Narsingdi -> Dhaka Sub Area; other districts -> Outside Dhaka. - Customer may manually override Delivery area. Savar customers can use the Dhaka district and manually select Dhaka Sub Area while entering Savar in the full address. - Before a district is chosen, the existing Inside Dhaka default remains. - Free delivery keeps the existing threshold, based on actual product subtotal BEFORE coupon discount. - Selected variation prices are verified server-side for subtotal/free delivery, not the parent product's minimum price. - Cart drawer delivery estimate now uses configured zone rates rather than hardcoded 80–130. NEW ENV KEYS (all three supplied env files have matching values) NEXT_PUBLIC_DHAKA_SUB_AREA_LABEL="Dhaka Sub Area" DHAKA_SUB_AREA_LABEL="Dhaka Sub Area" NEXT_PUBLIC_SHIPPING_DHAKA_SUB_AREA=100 SHIPPING_DHAKA_SUB_AREA=100 NEXT_PUBLIC_DHAKA_SUB_AREA_LOCATIONS=Gazipur,Savar,Narayanganj,Narsingdi - Keep public/private fee and label pairs equal. - NEXT_PUBLIC values are build-time client configuration: changing them requires a rebuild/restart. - Existing secrets, domains and other env values are preserved byte-for-byte before the appended block. COUPON - Checkout field defaults to Hidden/OFF. Existing checkout remains usable if plugin coupon endpoints are unavailable. - Next.js Editor -> Coupon -> Visible -> Save visibility (or Save All Changes), then refresh checkout. No rebuild is needed just for coupon settings/coupon value changes. - offer100 = fixed 100 BDT; nov100 = 10%. - Default min/max are 0; maximum 0 means unlimited. - Minimum/maximum conditions refer to PRODUCT SUBTOTAL, not shipping or the final discounted total. - One coupon per order; fixed/percentage discounts affect products only. - Apply previews validate live prices and stock without saving orders or increasing usage. - Place order revalidates, then WooCommerce applies the native coupon. WooCommerce maintains discount lines/usage counts and status-related reversals. - A cart product/quantity/price change clears the applied coupon. Apply again. - Existing coupons with matching default codes are NEVER overwritten; they are not automatically adopted into this module. If a collision exists, create a different managed coupon code in the Coupon tab. - The managed list does not alter unrelated existing WooCommerce coupons. - Used coupon codes cannot be renamed, preserving history. Values/status/min/max can be updated. - The details modal reads WooCommerce order items and works with classic storage and HPOS. History can include cancelled/refunded orders; native usage count may therefore differ from historical order count. - Coupon settings live in a separate option; no existing settings reset or database-table migration is introduced. - Server coupon preview uses the existing WooCommerce REST credentials; their permissions must allow the existing checkout write operations. CHECKS COMPLETED - PHP lint of all four plugin PHP modules; admin JavaScript syntax check. - Syntax checked across all supplied Next.js source files; TypeScript check. - Isolated production build passed using Next 14 / React 18 fixture. Your original root package/config files were not supplied; this does not replace building your actual project. - 21 mocked server/shipping/checkout regression tests. - 16 PHP tests using actual WooCommerce WC_Discounts with isolated WordPress/product stubs. - 11 coupon admin backend tests for create/update/min/max, nonce/capability guards, usage preservation and existing settings preservation (isolated stubs). - 12 local checkout browser UI tests; 8 local admin browser UI tests with mocked admin AJAX. - Desktop/mobile layouts reviewed; 64-district list and earlier AddToCart fix unchanged. - No live plugin install, real WooCommerce database integration, real order or Meta/GA4 delivery test was performed for this update. POST-DEPLOY SMOKE TEST 1. Coupon Hidden -> checkout stays unchanged. 2. Pick Gazipur/Narayanganj/Narsingdi -> Dhaka Sub Area / 100 BDT; manually change area and verify it stays selected. 3. Enable coupon field; test offer100 and nov100, minimum/maximum failure and inactive code. 4. Place ONE authorized test order; check WooCommerce variation, delivery fee, coupon line, discount, final total, native usage count and modal history. 5. Check purchase dataLayer value against the final WooCommerce total. Cancel the test order when finished. ROLLBACK Restore the backed-up src/env files and plugin folder, then rebuild/restart Next.js. New coupon posts/options are not deleted automatically; existing orders/history are preserved. Do not uninstall the plugin to roll back.