{
“analysis”: “Atomic Edge analysis of CVE-2026-132227: This is an authenticated (Author+) stored cross-site scripting vulnerability in ShopLentor (All-in-One WooCommerce Growth & Store Enhancement Plugin) versions up to and including 3.5.9. The flaw resides in the countdown block of several widgets (e.g., Flash Sale, Universal Product, Product Flash Sale). An attacker with author-level access can supply a malicious payload via the ‘customlabel_days’ (and related) parameter. When an Elementor page contains a countdown widget for a product on sale with a sale end date, the unsanitized value is emitted into a data attribute, leading to script execution in the browser of any user viewing that page. The CVSS score is 6.4 (Medium), reflecting the need for authentication and specific conditions for exploitation.nnRoot Cause: The vulnerability stems from insufficient output escaping in multiple files. In product_flash_sale.php (lines 1027-1030), the custom label values were passed through esc_html() before being JSON-encoded and embedded into a data attribute without proper attribute escaping. Similarly, in universal_product.php (lines 2217-2220), the values were not sanitized at all before JSON encoding. The data attributes (data-customlavel) were enclosed in single quotes, and the JSON output was not escaped for HTML attribute context, allowing an attacker to break out of the attribute by injecting a single quote and arbitrary JavaScript. Atomic Edge research confirms that the root cause is the lack of sanitization on input combined with inadequate output escaping in the affected widget rendering functions.nnExploitation: An attacker with Author-level access can craft a malicious payload and store it via the widget settings. For example, the attacker could set the ‘customlabel_days’ parameter to a value like `’; alert(document.cookie);//` or `'”>alert(1)`. When the widget is rendered (with a qualifying on-sale product and Elementor active), the payload breaks out of the single-quoted data-customlavel attribute and executes. The attack requires the victim to visit the page containing the widget, which could be a public post or page. The injected script runs in the context of the victim’s browser, allowing theft of cookies, session hijacking, or other client-side attacks.nnPatch Analysis: The patch implements two layers of defense. First, input sanitization: In product_flash_sale.php (lines 1027-1030) and universal_product.php (lines 2217-2220), the custom label values are now passed through sanitize_text_field() before being stored in the array. Second, output escaping: The data-customlavel attribute is now enclosed in double quotes, and the JSON-encoded value is escaped with esc_attr() (e.g., line 1152 in product_flash_sale.php). This ensures that any remaining special characters are safely encoded, preventing breakouts. The patch also addresses similar issues in other widgets (compare-table, product-tabs, category-grid, recently-viewed, ajax-search, badges) by applying esc_attr() to JSON data in attributes. These changes fix the vulnerability by ensuring that user-controlled input cannot break out of the HTML attribute context.nnImpact: If exploited, this stored XSS vulnerability allows an attacker to execute arbitrary JavaScript in the browsers of users who view the affected page. This can lead to cookie theft, session hijacking, redirection to malicious sites, defacement, or other client-side attacks. Given the requirement for Author-level access, the attacker must already have some privileges on the WordPress site, but they can leverage this flaw to escalate their attack to site administrators or visitors. The CVSS score of 6.4 reflects the medium severity due to the authentication requirement and specific conditions needed for exploitation.”,
“poc_php”: “ $password,n ‘wp-submit’ => ‘Log In’,n ‘redirect_to’ => $target_url . ‘/wp-admin/’,n ‘testcookie’ => ‘1’n]));ncurl_setopt($ch, CURLOPT_COOKIEJAR, ‘/tmp/cookies.txt’);ncurl_setopt($ch, CURLOPT_COOKIEFILE, ‘/tmp/cookies.txt’);ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);n$response = curl_exec($ch);ncurl_close($ch);nn// Step 2: Retrieve the nonce for the Elementor editor (if needed) or directly update the post meta.n// In a real scenario, the attacker would use the Elementor editor to modify the widget settings.n// For simplicity, we assume the attacker has the ability to update the post meta via the WordPress REST API or admin-ajax.nn// Alternatively, the attacker could craft a request to the Elementor save action.n// This PoC uses a simplified approach: directly updating the post meta via the WordPress admin.n// In practice, the attacker would use the Elementor interface to set the custom label.nn// Step 3: The payload is stored in the widget settings. When the page is rendered, the payload executes.n// To verify, visit the page as any user.nnecho “PoC: Logged in as $username. Now manually set the ‘customlabel_days’ field in the countdown widget to: $payload\n”;necho “Then visit the page with ID $post_id to trigger the XSS.\n”;nn// Note: This PoC is incomplete as it requires actual interaction with the Elementor editor.n// A full automated PoC would need to reverse-engineer the Elementor save process, which is beyond scope.n// However, the vulnerability is proven by the lack of sanitization in the code.nn// For a complete PoC, one would need to:n// 1. Authenticate as author (done above).n// 2. Create or edit a post with Elementor, adding a countdown widget.n// 3. Set the ‘customlabel_days’ to the payload via the Elementor UI or by directly manipulating the post meta.n// 4. Publish the post.n// 5. Visit the post to trigger the XSS.nn// Since this is a conceptual PoC, we return null to indicate that a full working exploit requires more steps.nreturn null;n?>”,
“modsecurity_rule”: null
}

CVE-2026-132227: ShopLentor <= 3.5.9 Authenticated (Author+) Stored Cross-Site Scripting via 'customlabel_days' Parameter PoC, Patch Analysis & Rule
CVE-2026-132227
woolentor-addons
3.5.9
3.6.0
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.
Analysis Overview
Differential between vulnerable and patched code
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/woolentor-addons/classes/class.ajax_actions.php
+++ b/woolentor-addons/classes/class.ajax_actions.php
@@ -628,9 +628,17 @@
$setting_data = isset( $_POST['settings'] ) ? (is_string($_POST['settings']) ? stripslashes( $_POST['settings'] ) : '' ) : '';
$setting_data = json_decode( $setting_data, true );
- $view_layout = isset( $_POST['viewlayout'] ) ? $_POST['viewlayout'] : '';
- if(!empty($view_layout)){
+ // The settings come from a data attribute in the page markup, so treat them as untrusted.
+ if ( ! is_array( $setting_data ) ) {
+ wp_send_json_error( array( 'message' => __( 'Invalid request', 'woolentor' ) ) );
+ }
+ $setting_data = $this->sanitize_load_more_settings( $setting_data );
+
+ // The view switcher only sends "grid" or "list".
+ $view_layout = isset( $_POST['viewlayout'] ) && is_string( $_POST['viewlayout'] ) ? sanitize_key( $_POST['viewlayout'] ) : '';
+
+ if ( in_array( $view_layout, [ 'grid', 'list' ], true ) ) {
$setting_data['layout'] = $view_layout;
}
@@ -651,6 +659,55 @@
}
/**
+ * Normalize the grid settings posted by Load More / Infinite Scroll.
+ *
+ * They are read from the data-wl-widget-settings attribute in the page, so any visitor can
+ * change them. Clamp the values that drive the product query so a request cannot ask for an
+ * unbounded number of products or query an arbitrary taxonomy.
+ *
+ * @param array $settings
+ * @return array
+ */
+ private function sanitize_load_more_settings( $settings ) {
+
+ // Same range as the "Products Per Page" control (1 - 1000); -1 / 0 / huge values fall back to the default.
+ $per_page = isset( $settings['posts_per_page'] ) && is_numeric( $settings['posts_per_page'] ) ? (int) $settings['posts_per_page'] : 12;
+ $settings['posts_per_page'] = ( $per_page >= 1 && $per_page <= 1000 ) ? $per_page : 12;
+
+ foreach ( [ 'offset', 'current_product_id' ] as $key ) {
+ if ( isset( $settings[ $key ] ) ) {
+ $settings[ $key ] = is_scalar( $settings[ $key ] ) ? absint( $settings[ $key ] ) : 0;
+ }
+ }
+
+ foreach ( [ 'include_products', 'exclude_products' ] as $key ) {
+ if ( isset( $settings[ $key ] ) ) {
+ $ids = is_array( $settings[ $key ] ) ? $settings[ $key ] : explode( ',', (string) $settings[ $key ] );
+ $ids = array_filter( array_map( 'absint', array_filter( $ids, 'is_scalar' ) ) );
+ $settings[ $key ] = array_values( $ids );
+ }
+ }
+
+ // Archive context: only a public taxonomy and a numeric term ID.
+ if ( isset( $settings['queried_object'] ) ) {
+ $queried = is_array( $settings['queried_object'] ) ? $settings['queried_object'] : [];
+ $taxonomy = isset( $queried['taxonomy'] ) && is_string( $queried['taxonomy'] ) ? sanitize_key( $queried['taxonomy'] ) : '';
+ $term_id = isset( $queried['term_id'] ) && is_scalar( $queried['term_id'] ) ? absint( $queried['term_id'] ) : 0;
+
+ if ( $taxonomy && $term_id && taxonomy_exists( $taxonomy ) && ( ! function_exists( 'is_taxonomy_viewable' ) || is_taxonomy_viewable( $taxonomy ) ) ) {
+ $settings['queried_object'] = [
+ 'taxonomy' => $taxonomy,
+ 'term_id' => $term_id,
+ ];
+ } else {
+ unset( $settings['queried_object'] );
+ }
+ }
+
+ return $settings;
+ }
+
+ /**
* Put the filter parameters of the page URL back into $_GET.
*
* The product filters (Horizontal Filter, WooCommerce sorting, Product Filter module) read
--- a/woolentor-addons/includes/addons/pack-widgets/elementor/compare-table/compare_table.php
+++ b/woolentor-addons/includes/addons/pack-widgets/elementor/compare-table/compare_table.php
@@ -275,7 +275,8 @@
$ids = EverCompareFrontendManage_Compare::instance()->get_compared_products();
- return array_values( array_unique( array_filter( array_map( 'absint', is_array( $ids ) ? $ids : [] ) ) ) );
+ // Each product in the current language (WPML / Polylang); it may be saved under another language's ID.
+ return array_values( array_unique( woolentor_current_language_ids( is_array( $ids ) ? $ids : [], 'product' ) ) );
}
/**
--- a/woolentor-addons/includes/addons/pack-widgets/elementor/flash-sale/flash_sale.php
+++ b/woolentor-addons/includes/addons/pack-widgets/elementor/flash-sale/flash_sale.php
@@ -521,7 +521,7 @@
* @return array
*/
protected function deal_args( array $deal, $limit ) {
- $exclude = array_map( 'absint', (array) ( $deal['exclude_products'] ?? [] ) );
+ $exclude = woolentor_current_language_ids( $deal['exclude_products'] ?? [], 'product' );
if ( 'on' === ( $deal['apply_on_all_products'] ?? '' ) ) {
return [
@@ -531,7 +531,7 @@
];
}
- $ids = array_map( 'absint', (array) ( $deal['products'] ?? [] ) );
+ $ids = woolentor_current_language_ids( $deal['products'] ?? [], 'product' );
if ( ! empty( $deal['categories'] ) ) {
$ids = array_merge( $ids, get_posts( [
@@ -543,7 +543,7 @@
'tax_query' => [ [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
'taxonomy' => 'product_cat',
'field' => 'term_id',
- 'terms' => array_map( 'absint', (array) $deal['categories'] ),
+ 'terms' => woolentor_current_language_ids( $deal['categories'], 'product_cat' ),
] ],
] ) );
}
--- a/woolentor-addons/includes/addons/product_flash_sale.php
+++ b/woolentor-addons/includes/addons/product_flash_sale.php
@@ -1027,10 +1027,10 @@
$countdown_title = $settings['countdown_title'];
$data_customlavel = [];
if( $show_countdown == 'yes' ){
- $data_customlavel['daytxt'] = ! empty( $settings['customlabel_days'] ) ? esc_html($settings['customlabel_days']) : __('Days', 'woolentor');
- $data_customlavel['hourtxt'] = ! empty( $settings['customlabel_hours'] ) ? esc_html($settings['customlabel_hours']) : __('Hours', 'woolentor');
- $data_customlavel['minutestxt'] = ! empty( $settings['customlabel_minutes'] ) ? esc_html($settings['customlabel_minutes']) : __('Min', 'woolentor');
- $data_customlavel['secondstxt'] = ! empty( $settings['customlabel_seconds'] ) ? esc_html($settings['customlabel_seconds']) : __('Sec', 'woolentor');
+ $data_customlavel['daytxt'] = ! empty( $settings['customlabel_days'] ) ? sanitize_text_field( $settings['customlabel_days'] ) : __('Days', 'woolentor');
+ $data_customlavel['hourtxt'] = ! empty( $settings['customlabel_hours'] ) ? sanitize_text_field( $settings['customlabel_hours'] ) : __('Hours', 'woolentor');
+ $data_customlavel['minutestxt'] = ! empty( $settings['customlabel_minutes'] ) ? sanitize_text_field( $settings['customlabel_minutes'] ) : __('Min', 'woolentor');
+ $data_customlavel['secondstxt'] = ! empty( $settings['customlabel_seconds'] ) ? sanitize_text_field( $settings['customlabel_seconds'] ) : __('Sec', 'woolentor');
}
// Stock Progress bar
@@ -1063,9 +1063,9 @@
}
$apply_on_all_products = !empty($deal['apply_on_all_products']) ? $deal['apply_on_all_products'] : 'off';
- $include_categories = !empty($deal['categories']) ? $deal['categories'] : array();
- $include_products = !empty($deal['products']) ? $deal['products'] : array();
- $exclude_products = !empty($deal['exclude_products']) ? $deal['exclude_products'] : array();
+ $include_categories = !empty($deal['categories']) ? woolentor_current_language_ids( $deal['categories'], 'product_cat' ) : array();
+ $include_products = !empty($deal['products']) ? woolentor_current_language_ids( $deal['products'], 'product' ) : array();
+ $exclude_products = !empty($deal['exclude_products']) ? woolentor_current_language_ids( $deal['exclude_products'], 'product' ) : array();
$product_ids = array();
// Prepare product ids
@@ -1152,7 +1152,7 @@
</a>
<?php if($show_countdown == 'yes'): ?>
- <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
<?php endif; ?>
@@ -1198,7 +1198,7 @@
<?php endif; ?>
- <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
</div>
<?php endif; ?>
--- a/woolentor-addons/includes/addons/product_tabs.php
+++ b/woolentor-addons/includes/addons/product_tabs.php
@@ -1649,7 +1649,7 @@
$slider_main_div_style = '';
if( $proslider == 'yes' ){
$slider_main_div_style = "style='display:none'";
- echo '<div id="'.esc_attr('product-slider-' . uniqid()).'" dir="'.esc_attr($direction).'" class="product-slider" '.$slider_main_div_style.' data-settings='' . wp_json_encode($slider_settings) . ''>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ echo '<div id="'.esc_attr('product-slider-' . uniqid()).'" dir="'.esc_attr($direction).'" class="product-slider" '.$slider_main_div_style.' data-settings="' . esc_attr( wp_json_encode( $slider_settings ) ) . '">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
--- a/woolentor-addons/includes/addons/universal_product.php
+++ b/woolentor-addons/includes/addons/universal_product.php
@@ -2217,10 +2217,10 @@
// Countdown Custom Label
if( $settings['show_countdown'] == 'yes' ){
$data_customlavel = [];
- $data_customlavel['daytxt'] = ! empty( $settings['customlabel_days'] ) ? $settings['customlabel_days'] : 'Days';
- $data_customlavel['hourtxt'] = ! empty( $settings['customlabel_hours'] ) ? $settings['customlabel_hours'] : 'Hours';
- $data_customlavel['minutestxt'] = ! empty( $settings['customlabel_minutes'] ) ? $settings['customlabel_minutes'] : 'Min';
- $data_customlavel['secondstxt'] = ! empty( $settings['customlabel_seconds'] ) ? $settings['customlabel_seconds'] : 'Sec';
+ $data_customlavel['daytxt'] = ! empty( $settings['customlabel_days'] ) ? sanitize_text_field( $settings['customlabel_days'] ) : 'Days';
+ $data_customlavel['hourtxt'] = ! empty( $settings['customlabel_hours'] ) ? sanitize_text_field( $settings['customlabel_hours'] ) : 'Hours';
+ $data_customlavel['minutestxt'] = ! empty( $settings['customlabel_minutes'] ) ? sanitize_text_field( $settings['customlabel_minutes'] ) : 'Min';
+ $data_customlavel['secondstxt'] = ! empty( $settings['customlabel_seconds'] ) ? sanitize_text_field( $settings['customlabel_seconds'] ) : 'Sec';
}
// Slider Options
@@ -2429,7 +2429,7 @@
):
?>
<div class="ht-product-countdown-wrap">
- <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
</div>
<?php endif; endif; ?>
@@ -2522,7 +2522,7 @@
):
?>
<div class="ht-product-countdown-wrap">
- <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
</div>
<?php endif; endif; ?>
</div>
@@ -2547,7 +2547,7 @@
echo '<div class="ht-row">';
}
?>
- <div class="<?php echo $same_height_box == 'yes' ? 'woolentor-product-same-height' : ''; ?> ht-products woocommerce <?php if( $settings['product_layout_style'] == 'slider' ){ echo esc_attr( 'product-slider' ); } else{ echo 'ht-row'; } ?>" dir="<?php echo esc_attr($direction); ?>" data-settings='<?php if( $settings['product_layout_style'] == 'slider' ){ echo wp_json_encode( $slider_settings ); } ?>' <?php echo $slider_main_div_style; ?> >
+ <div class="<?php echo $same_height_box == 'yes' ? 'woolentor-product-same-height' : ''; ?> ht-products woocommerce <?php if( $settings['product_layout_style'] == 'slider' ){ echo esc_attr( 'product-slider' ); } else{ echo 'ht-row'; } ?>" dir="<?php echo esc_attr($direction); ?>" data-settings="<?php if( $settings['product_layout_style'] == 'slider' ){ echo esc_attr( wp_json_encode( $slider_settings ) ); } ?>" <?php echo $slider_main_div_style; ?> >
<?php
if( $products->have_posts() ):
@@ -2628,7 +2628,7 @@
):
?>
<div class="ht-product-countdown-wrap">
- <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
</div>
<?php endif; endif; ?>
@@ -2720,7 +2720,7 @@
):
?>
<div class="ht-product-countdown-wrap">
- <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="ht-product-countdown" data-countdown="<?php echo esc_attr( $offer_end_date ); ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
</div>
<?php endif; endif; ?>
</div>
--- a/woolentor-addons/includes/addons/wl_category_grid.php
+++ b/woolentor-addons/includes/addons/wl_category_grid.php
@@ -1171,7 +1171,7 @@
$placeholder_image = sprintf( '<img src="%s" alt="%s" />', esc_url( wc_placeholder_img_src( 'woocommerce_single' ) ), esc_html__( 'Awaiting category image', 'woolentor' ) );
- echo '<div class="wl-row '.( $settings['no_gutters'] === 'yes' ? 'wlno-gutters' : '' ).' '.( $settings['slider_on'] === 'yes' ? 'product-slider' : '' ).' " data-settings='.wp_json_encode( $slider_settings ).' '.$slider_main_div_style.'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ echo '<div class="wl-row '.( $settings['no_gutters'] === 'yes' ? 'wlno-gutters' : '' ).' '.( $settings['slider_on'] === 'yes' ? 'product-slider' : '' ).' " data-settings="'.esc_attr( wp_json_encode( $slider_settings ) ).'" '.$slider_main_div_style.'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
foreach ( $prod_categories as $key => $prod_cat ):
$counter++;
$bgc++;
--- a/woolentor-addons/includes/addons/wl_recently_viewed_products.php
+++ b/woolentor-addons/includes/addons/wl_recently_viewed_products.php
@@ -1286,10 +1286,10 @@
);
$products = new WP_Query( $args );
- //echo '<div class="wl-row '.( $settings['no_gutters'] === 'yes' ? 'wlno-gutters' : '' ).' '.( $settings['slider_on'] === 'yes' ? 'product-slider' : '' ).' " data-settings='.wp_json_encode( $slider_settings ).' '.$slider_main_div_style.'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ //echo '<div class="wl-row '.( $settings['no_gutters'] === 'yes' ? 'wlno-gutters' : '' ).' '.( $settings['slider_on'] === 'yes' ? 'product-slider' : '' ).' " data-settings="'.esc_attr( wp_json_encode( $slider_settings ) ).'" '.$slider_main_div_style.'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( $products->have_posts() ) {
- echo '<div class="wl-row '.( $same_height_box == 'yes' ? 'woolentor-product-same-height' : '' ).' '.( $settings['slider_on'] === 'yes' ? 'product-slider' : '' ).' " data-settings='.wp_json_encode( $slider_settings ).' '.$slider_main_div_style.'>';
+ echo '<div class="wl-row '.( $same_height_box == 'yes' ? 'woolentor-product-same-height' : '' ).' '.( $settings['slider_on'] === 'yes' ? 'product-slider' : '' ).' " data-settings="'.esc_attr( wp_json_encode( $slider_settings ) ).'" '.$slider_main_div_style.'>';
while( $products->have_posts() ): $products->the_post();
?>
<div class="<?php echo esc_attr( $collumval ); ?>">
--- a/woolentor-addons/includes/helper-function.php
+++ b/woolentor-addons/includes/helper-function.php
@@ -283,6 +283,74 @@
}
/**
+ * Map a saved post or term ID to the current language (WPML / Polylang).
+ *
+ * Settings store the IDs picked in the admin, which belong to one language. On a translated page
+ * the same product, page or category has another ID. Without a translation plugin, or when the
+ * item has no translation, the ID comes back as it is. Non-numeric values (e.g. 'custom') too.
+ *
+ * @param mixed $id
+ * @param string $type Post type or taxonomy, e.g. 'product', 'page', 'product_cat'.
+ * @return mixed
+ */
+if( ! function_exists( 'woolentor_current_language_id' ) ){ // Pro ships a copy for older free versions.
+function woolentor_current_language_id( $id, $type = 'product' ){
+ if( empty( $id ) || ! is_numeric( $id ) ){
+ return $id;
+ }
+ return (int) apply_filters( 'wpml_object_id', (int) $id, $type, true );
+}
+}
+
+/**
+ * Map a list of saved post or term IDs to the current language.
+ *
+ * @see woolentor_current_language_id()
+ * @param mixed $ids Array or comma separated string of IDs.
+ * @param string $type Post type or taxonomy.
+ * @return int[]
+ */
+if( ! function_exists( 'woolentor_current_language_ids' ) ){
+function woolentor_current_language_ids( $ids, $type = 'product' ){
+ if( empty( $ids ) ){
+ return [];
+ }
+ if( ! is_array( $ids ) ){
+ $ids = explode( ',', (string) $ids );
+ }
+ $mapped = [];
+ foreach( $ids as $id ){
+ $id = absint( $id );
+ if( $id ){
+ $mapped[] = woolentor_current_language_id( $id, $type );
+ }
+ }
+ return $mapped;
+}
+}
+
+/**
+ * IDs to match against: the saved IDs plus the same items in the current language.
+ *
+ * For checks such as "is this product in the list". The saved IDs stay, so whatever matched
+ * before still matches; translated copies match too. Not for building product lists, where
+ * both copies would show (use woolentor_current_language_ids() there).
+ *
+ * @param mixed $ids Array or comma separated string of IDs.
+ * @param string $type Post type or taxonomy.
+ * @return int[]
+ */
+if( ! function_exists( 'woolentor_language_match_ids' ) ){
+function woolentor_language_match_ids( $ids, $type = 'product' ){
+ if( empty( $ids ) ){
+ return [];
+ }
+ $saved = array_filter( array_map( 'absint', is_array( $ids ) ? $ids : explode( ',', (string) $ids ) ) );
+ return array_values( array_unique( array_merge( $saved, woolentor_current_language_ids( $saved, $type ) ) ) );
+}
+}
+
+/**
* Register a string for translation with WPML/Polylang
* Must be called before woolentor_translator() can find translations
*
--- a/woolentor-addons/includes/modules/ajax-search/ajax-search.php
+++ b/woolentor-addons/includes/modules/ajax-search/ajax-search.php
@@ -147,7 +147,7 @@
ob_start();
?>
<div class="woolentor_widget_psa" id="<?php echo esc_attr('wluniq-'.uniqid()); ?>">
- <form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" data-settings='<?php echo wp_json_encode( $data_settings ); ?>'>
+ <form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" data-settings="<?php echo esc_attr( wp_json_encode( $data_settings ) ); ?>">
<div class="woolentor_widget_psa_field_area">
<?php if( $show_category === true ):?>
<div class="woolentor_widget_psa_category">
--- a/woolentor-addons/includes/modules/badges/badges.php
+++ b/woolentor-addons/includes/modules/badges/badges.php
@@ -76,4 +76,16 @@
}
+ /**
+ * String name a badge's text is registered and translated under (WPML / Polylang).
+ *
+ * Built from the badge title, so two badges with the same title share one translation.
+ * @param array $badge
+ * @return string
+ */
+ public static function text_string_name( $badge ){
+ $title = !empty( $badge['badge_title'] ) ? $badge['badge_title'] : 'Badge One'; // Not translated: the name must be the same in every language.
+ return 'woolentor_badge_text_' . str_replace( ' ', '', trim( preg_replace( '/(.+)/', '', $title ) ) );
+ }
+
}
No newline at end of file
--- a/woolentor-addons/includes/modules/badges/includes/classes/Admin.php
+++ b/woolentor-addons/includes/modules/badges/includes/classes/Admin.php
@@ -33,6 +33,29 @@
*/
public function init(){
AdminFields::instance();
+ add_action( 'admin_init', [ $this, 'register_badge_strings' ] );
+ }
+
+ /**
+ * Register each badge's text with WPML / Polylang so it can be translated.
+ *
+ * Runs on every admin load: Polylang needs that, and WPML skips a string it already has.
+ * @return void
+ */
+ public function register_badge_strings(){
+ if ( ! function_exists( 'woolentor_register_string' ) ) {
+ return;
+ }
+ $badges_list = woolentor_get_option( 'badges_list', 'woolentor_badges_settings', [] );
+ if ( empty( $badges_list ) || ! is_array( $badges_list ) ) {
+ return;
+ }
+ foreach ( $badges_list as $badge ) {
+ if ( empty( $badge['badge_text'] ) || ! is_string( $badge['badge_text'] ) ) {
+ continue;
+ }
+ woolentor_register_string( Product_Badges::text_string_name( $badge ), $badge['badge_text'] );
+ }
}
}
No newline at end of file
--- a/woolentor-addons/includes/modules/badges/includes/classes/Frontend/Badge_Manager.php
+++ b/woolentor-addons/includes/modules/badges/includes/classes/Frontend/Badge_Manager.php
@@ -69,7 +69,7 @@
* @return bool
*/
private function is_excluded($product_id, $badge) {
- $exclude_product_ids = !empty($badge['exclude_products']) ? $badge['exclude_products'] : [];
+ $exclude_product_ids = !empty($badge['exclude_products']) ? woolentor_language_match_ids( $badge['exclude_products'], 'product' ) : [];
if( woolentor_is_pro() ){
return in_array($product_id, $exclude_product_ids);
}else{
@@ -91,7 +91,7 @@
}
return [];
}
-
+
/**
* Manage Selected Product Condition
* @param mixed $badge
@@ -99,7 +99,7 @@
* @return void
*/
private function handle_selected_product_condition($badge, $product_id) {
- if (!empty($badge['products']) && in_array($product_id, $badge['products'])) {
+ if (!empty($badge['products']) && in_array($product_id, woolentor_language_match_ids( $badge['products'], 'product' ))) {
$this->badge_html($badge);
}
}
@@ -111,7 +111,7 @@
* @return void
*/
private function handle_category_condition($badge, $product) {
- $category_list = !empty($badge['categories']) ? $badge['categories'] : [];
+ $category_list = !empty($badge['categories']) ? woolentor_language_match_ids( $badge['categories'], 'product_cat' ) : [];
$product_categories = $product->get_category_ids();
$match_category = array_intersect($product_categories, $category_list);
--- a/woolentor-addons/includes/modules/badges/includes/templates/badge-text.php
+++ b/woolentor-addons/includes/modules/badges/includes/templates/badge-text.php
@@ -1,8 +1,9 @@
<?php
- $badge_title = !empty( $badge['badge_title'] ) ? $badge['badge_title'] : esc_html__('Badge One','woolentor');
- $badge_translate_name = str_replace(' ', '', trim(preg_replace('/(.+)/', '', $badge_title)));
-
- $badge_text = !empty( $badge['badge_text'] ) ? woolentor_translator('woolentor_badge_text_'.$badge_translate_name, $badge['badge_text']) : "";
+ // A text set on the product screen is translated with the product, not as a badge string.
+ $badge_text = !empty( $badge['badge_text'] ) ? $badge['badge_text'] : "";
+ if( $badge_text && empty( $badge['has_ind'] ) ){
+ $badge_text = woolentor_translator( WoolentorModulesBadgesProduct_Badges::text_string_name( $badge ), $badge_text );
+ }
$badges_class = (!empty( $badge['has_ind'] ) && $badge['has_ind'] === true) ? 'ht-product-label ht-product-label-left' : '';
$badge_postion= !empty( $badge['badge_position'] ) ? $badge['badge_position'] : "";
--- a/woolentor-addons/includes/modules/compare/includes/classes/Frontend/Manage_Compare.php
+++ b/woolentor-addons/includes/modules/compare/includes/classes/Frontend/Manage_Compare.php
@@ -259,6 +259,9 @@
$products = $this->get_compared_products();
+ // The product may be saved under its ID in another language.
+ $id = $this->stored_product_id( $id );
+
foreach ( $products as $prod_key => $product_id ) {
if ( intval( $id ) == $product_id ) {
unset( $products[ $prod_key ] );
@@ -325,6 +328,9 @@
return array();
}
+ // Show each product in the current language (WPML / Polylang).
+ $ids = array_values( array_unique( woolentor_current_language_ids( $ids, 'product' ) ) );
+
$args = array(
'include' => $ids,
'limit' => -1
@@ -581,8 +587,38 @@
* @return [array] product id list
*/
public function is_product_in_compare( $id ) {
+ return isset( $this->current_language_id_map()[ absint( $id ) ] );
+ }
+
+ /**
+ * [current_language_id_map] Saved compare IDs, keyed by the same product's ID in the current language.
+ *
+ * A product is saved under the ID of the page it was added from. On a translated site
+ * (WPML / Polylang) that may be another language, where the product has another ID.
+ * @return [array] current language id => saved id
+ */
+ public function current_language_id_map() {
+ $map = array();
$list = $this->get_compared_products();
- return in_array( $id, $list, true );
+ foreach ( is_array( $list ) ? $list : array() as $saved_id ) {
+ $saved_id = absint( $saved_id );
+ $current_id = woolentor_current_language_id( $saved_id, 'product' );
+ if ( $saved_id && ! isset( $map[ $current_id ] ) ) {
+ $map[ $current_id ] = $saved_id;
+ }
+ }
+ return $map;
+ }
+
+ /**
+ * [stored_product_id] The ID a product is saved under in the compare list.
+ * @param [int] $id Product ID in the current language.
+ * @return [int]
+ */
+ public function stored_product_id( $id ) {
+ $id = absint( $id );
+ $map = $this->current_language_id_map();
+ return isset( $map[ $id ] ) ? $map[ $id ] : $id;
}
/**
@@ -625,7 +661,7 @@
*/
public function get_compare_page_url() {
$page_id = woolentor_get_option( 'compare_page', 'ever_compare_table_settings_tabs' );
- return get_permalink( $page_id );
+ return get_permalink( woolentor_current_language_id( $page_id, 'page' ) );
}
/**
--- a/woolentor-addons/includes/modules/flash-sale/flash-sale.php
+++ b/woolentor-addons/includes/modules/flash-sale/flash-sale.php
@@ -469,9 +469,10 @@
$validity = false;
$apply_on_all_products = !empty( $deal['apply_on_all_products'] ) ? $deal['apply_on_all_products'] : '';
- $applicable_categories = !empty( $deal['categories'] ) ? $deal['categories'] : array();
- $applicable_products = !empty( $deal['products'] ) ? $deal['products'] : array();
- $exclude_products = !empty( $deal['exclude_products'] ) ? $deal['exclude_products'] : array();
+ // Saved IDs belong to one language; map them to the language of the product being checked.
+ $applicable_categories = !empty( $deal['categories'] ) ? woolentor_language_match_ids( $deal['categories'], 'product_cat' ) : array();
+ $applicable_products = !empty( $deal['products'] ) ? woolentor_language_match_ids( $deal['products'], 'product' ) : array();
+ $exclude_products = !empty( $deal['exclude_products'] ) ? woolentor_language_match_ids( $deal['exclude_products'], 'product' ) : array();
if( ! $product ){
return false;
@@ -635,7 +636,7 @@
<p class="woolentor-flash-product-offer-timer-text"><?php echo wp_kses_post( $countdown_heading ) ?></p>
<?php endif; ?>
- <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel='<?php echo wp_json_encode( $custom_labels ) ?>'></div>
+ <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $custom_labels ) ); ?>"></div>
</div>
<?php
--- a/woolentor-addons/includes/modules/flash-sale/includes/blocks/product-flash-sale/index.php
+++ b/woolentor-addons/includes/modules/flash-sale/includes/blocks/product-flash-sale/index.php
@@ -37,10 +37,10 @@
$data_customlavel = [];
if( $show_countdown == 'yes' ){
- $data_customlavel['daytxt'] = $show_custom_lavel && !empty( $settings['customlabelDays'] ) ? esc_html($settings['customlabelDays']) : __('Days', 'woolentor');
- $data_customlavel['hourtxt'] = $show_custom_lavel && !empty( $settings['customlabelHours'] ) ? esc_html($settings['customlabelHours']) : __('Hours', 'woolentor');
- $data_customlavel['minutestxt'] = $show_custom_lavel && !empty( $settings['customlabelMinutes'] ) ? esc_html($settings['customlabelMinutes']) : __('Min', 'woolentor');
- $data_customlavel['secondstxt'] = $show_custom_lavel && !empty( $settings['customlabelSeconds'] ) ? esc_html($settings['customlabelSeconds']) : __('Sec', 'woolentor');
+ $data_customlavel['daytxt'] = $show_custom_lavel && !empty( $settings['customlabelDays'] ) ? sanitize_text_field( $settings['customlabelDays'] ) : __('Days', 'woolentor');
+ $data_customlavel['hourtxt'] = $show_custom_lavel && !empty( $settings['customlabelHours'] ) ? sanitize_text_field( $settings['customlabelHours'] ) : __('Hours', 'woolentor');
+ $data_customlavel['minutestxt'] = $show_custom_lavel && !empty( $settings['customlabelMinutes'] ) ? sanitize_text_field( $settings['customlabelMinutes'] ) : __('Min', 'woolentor');
+ $data_customlavel['secondstxt'] = $show_custom_lavel && !empty( $settings['customlabelSeconds'] ) ? sanitize_text_field( $settings['customlabelSeconds'] ) : __('Sec', 'woolentor');
}
// Stock Progress bar
@@ -73,9 +73,9 @@
}
$apply_on_all_products = !empty($deal['apply_on_all_products']) ? $deal['apply_on_all_products'] : 'off';
-$include_categories = !empty($deal['categories']) ? $deal['categories'] : [];
-$include_products = !empty($deal['products']) ? $deal['products'] : [];
-$exclude_products = !empty($deal['exclude_products']) ? $deal['exclude_products'] : [];
+$include_categories = !empty($deal['categories']) ? woolentor_current_language_ids( $deal['categories'], 'product_cat' ) : [];
+$include_products = !empty($deal['products']) ? woolentor_current_language_ids( $deal['products'], 'product' ) : [];
+$exclude_products = !empty($deal['exclude_products']) ? woolentor_current_language_ids( $deal['exclude_products'], 'product' ) : [];
$product_ids = [];
// Prepare product ids
@@ -111,7 +111,7 @@
}
if( $exclude_products ){
- $product_ids = array_intersect($product_ids, $exclude_products);
+ $product_ids = array_diff($product_ids, $exclude_products);
}
} elseif( $exclude_products ){
@@ -162,7 +162,7 @@
</a>
<?php if($show_countdown == 'yes'): ?>
- <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
<?php endif; ?>
@@ -208,7 +208,7 @@
<?php endif; ?>
- <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel='<?php echo wp_json_encode( $data_customlavel ) ?>'></div>
+ <div class="woolentor-countdown woolentor-countdown-<?php echo esc_attr($countdown_style); ?>" data-countdown="<?php echo esc_attr( $remaining_time ) ?>" data-customlavel="<?php echo esc_attr( wp_json_encode( $data_customlavel ) ); ?>"></div>
</div>
<?php endif; ?>
--- a/woolentor-addons/includes/modules/free-shipping-bar/includes/classes/Frontend/Bar_Renderer.php
+++ b/woolentor-addons/includes/modules/free-shipping-bar/includes/classes/Frontend/Bar_Renderer.php
@@ -194,9 +194,11 @@
$pages = self::setting( 'display_pages', [] );
// display_pages is a multiselect of WordPress page IDs (integers as strings).
- // Cast each entry to int and drop zeros/empty values.
+ // Cast each entry to int and drop zeros/empty values, and map each to the current
+ // language (WPML / Polylang): a translated page has another ID. Without a translation
+ // plugin the IDs stay as they are.
$page_ids = is_array( $pages )
- ? array_values( array_filter( array_map( 'absint', $pages ) ) )
+ ? woolentor_language_match_ids( $pages, 'page' )
: [];
if ( empty( $page_ids ) ) {
--- a/woolentor-addons/includes/modules/popup-builder/includes/admin/class-manage-metabox.php
+++ b/woolentor-addons/includes/modules/popup-builder/includes/admin/class-manage-metabox.php
@@ -615,7 +615,39 @@
'default' => '',
'wlpb_is_pro' => true
),
-
+ // show_on_geolocation
+ array(
+ 'name' => 'show_on_geolocation',
+ 'label' => __('Show by Visitor Location', 'woolentor'),
+ 'type' => 'checkbox',
+ 'class' => 'wlpb-field',
+ 'default' => '',
+ 'wlpb_is_pro' => true
+ ),
+ // geo_rule_type
+ array(
+ 'name' => 'geo_rule_type',
+ 'label' => __('Location Rule', 'woolentor'),
+ 'type' => 'select',
+ 'class' => 'wlpb-field',
+ 'options' => array(
+ 'include' => __('Show only in these countries', 'woolentor'),
+ 'exclude' => __('Hide in these countries', 'woolentor'),
+ ),
+ 'default' => 'include',
+ 'wlpb_is_pro' => true
+ ),
+ // geo_countries
+ array(
+ 'name' => 'geo_countries',
+ 'label' => __('Countries', 'woolentor'),
+ 'type' => 'select2',
+ 'class' => 'wlpb-field',
+ 'options' => array(), // Filled from WooCommerce countries in the template.
+ 'default' => '',
+ 'wlpb_is_pro' => true
+ ),
+
);
$fields = apply_filters( 'wlpb_module_fields', $fields );
--- a/woolentor-addons/includes/modules/popup-builder/includes/admin/tmpl-popup-builder-modal.php
+++ b/woolentor-addons/includes/modules/popup-builder/includes/admin/tmpl-popup-builder-modal.php
@@ -51,6 +51,12 @@
$show_on_browsers = '';
$allowed_browsers = array('chrome', 'firefox', 'safari', 'opera', 'ie', 'edge');
+// Geolocation
+$show_on_geolocation = '';
+$geo_rule_type = 'include';
+$geo_countries = array();
+$all_countries = ( function_exists('WC') && WC()->countries ) ? WC()->countries->get_countries() : array();
+
if( Helper::is_pro_version_active() ){
$pro_adv_class = '';
$opacity_class = '';
@@ -81,6 +87,11 @@
if( !empty($advanced_settings['browsers']) ){
$allowed_browsers = (array) $advanced_settings['browsers'];
}
+
+ // Advanced Rule - Show by Visitor Location
+ $show_on_geolocation = $advanced_settings['show_on_geolocation'];
+ $geo_rule_type = in_array( $advanced_settings['geo_rule_type'], array('include', 'exclude'), true ) ? $advanced_settings['geo_rule_type'] : 'include';
+ $geo_countries = !empty($advanced_settings['geo_countries']) ? (array) $advanced_settings['geo_countries'] : array();
}
wp_enqueue_script('js-cookie');
@@ -456,12 +467,47 @@
<option value="opera" <?php echo in_array('opera', $allowed_browsers) ? 'selected': '' ?>><?php esc_html_e('Opera', 'woolentor') ?></option>
<option value="ie" <?php echo in_array('ie', $allowed_browsers) ? 'selected': '' ?>><?php esc_html_e('IE', 'woolentor') ?></option>
<option value="edge" <?php echo in_array('edge', $allowed_browsers) ? 'selected': '' ?>><?php esc_html_e('Edge', 'woolentor') ?></option>
-
+
</select>
</div>
</div>
</div>
</div>
+
+ <!-- Geolocation -->
+ <div class="wplb-composite-field wlpb-geolocation-field <?php echo esc_attr($opacity_class) ?>">
+ <div class="wplb-composite-field-switcher wlpb-field">
+ <input type="checkbox" name="show_on_geolocation" id="show_on_geolocation" <?php checked( $show_on_geolocation, 1) ?>>
+ </div>
+ <div class="wplb-composite-field-label">
+ <label for="show_on_geolocation"><?php echo esc_html__('Show by Visitor Location', 'woolentor') ?></label>
+ </div>
+
+ <div class="wplb-composite-field-inner-controls">
+ <div class="wplb-composite-field-inner-control wlpb-field">
+ <div class="wplb-input-wrapper">
+ <select name="geo_rule_type" id="geo_rule_type">
+ <option value="include" <?php selected( $geo_rule_type, 'include') ?>><?php esc_html_e('Show only in these countries', 'woolentor') ?></option>
+ <option value="exclude" <?php selected( $geo_rule_type, 'exclude') ?>><?php esc_html_e('Hide in these countries', 'woolentor') ?></option>
+ </select>
+ </div>
+ </div>
+ </div>
+
+ <div class="wplb-composite-field-inner-controls wlpb-geo-countries">
+ <div class="wplb-composite-field-inner-control wlpb-field">
+ <div class="wplb-input-wrapper">
+ <select name="geo_countries[]" multiple="multiple" data-placeholder="<?php esc_attr_e('Search countries...', 'woolentor') ?>">
+ <?php foreach( $all_countries as $country_code => $country_name ): ?>
+ <option value="<?php echo esc_attr($country_code) ?>" <?php echo in_array($country_code, $geo_countries, true) ? 'selected': '' ?>><?php echo esc_html( html_entity_decode( $country_name ) ) ?></option>
+ <?php endforeach; ?>
+ </select>
+ </div>
+ </div>
+ </div>
+
+ <p class="wlpb-field-desc"><?php esc_html_e('Location is detected from the visitor IP using WooCommerce geolocation (WooCommerce > Settings > Integration > MaxMind). If you use a full-page cache, exclude these pages or vary the cache by country.', 'woolentor') ?></p>
+ </div>
<?php
if( !Helper::is_pro_version_active() ){
echo '</fieldset>';
--- a/woolentor-addons/includes/modules/popup-builder/includes/class-ajax-actions.php
+++ b/woolentor-addons/includes/modules/popup-builder/includes/class-ajax-actions.php
@@ -107,6 +107,7 @@
$post_data['advanced']['url_match'] = '';
$post_data['advanced']['show_on_devices'] = '';
$post_data['advanced']['show_on_browsers'] = '';
+ $post_data['advanced']['show_on_geolocation'] = '';
}
// Sanitize $post_data array.
--- a/woolentor-addons/includes/modules/popup-builder/includes/frontend/class-popup-rules-checker.php
+++ b/woolentor-addons/includes/modules/popup-builder/includes/frontend/class-popup-rules-checker.php
@@ -237,7 +237,11 @@
// Specific Singulars of a specific post type.
} else {
- if( is_singular($rule_sub_name) && in_array( get_queried_object_id(), explode(',', $rule_sub_id) ) ){
+ // The saved IDs, plus the same posts in the current language (WPML / Polylang).
+ $rule_sub_ids = explode(',', $rule_sub_id);
+ $rule_sub_ids = array_merge( $rule_sub_ids, woolentor_current_language_ids( $rule_sub_ids, $rule_sub_name ) );
+
+ if( is_singular($rule_sub_name) && in_array( get_queried_object_id(), $rule_sub_ids ) ){
$return_value = true;
}
}
@@ -289,6 +293,14 @@
// If the selected taxonomy is a valid taxonomy.
if( in_array( $selected_taxonomy, $taxonomies ) ){
+ // The saved terms, plus the same terms in the current language (WPML / Polylang):
+ // a translated post is in the translated terms, which have other IDs.
+ $query_terms = $selected_terms;
+ if( !empty( $selected_terms ) ){
+ $query_terms = explode( ',', $selected_terms );
+ $query_terms = array_values( array_unique( array_merge( $query_terms, woolentor_current_language_ids( $query_terms, $selected_taxonomy ) ) ) );
+ }
+
// Get posts of the $selected_terms in the $selected_taxonomy.
// We will need to match the $current_post_terms with the $posts_of_selected_terms.
$posts_of_selected_terms = get_posts( array(
@@ -298,7 +310,7 @@
array(
'taxonomy' => $selected_taxonomy,
'field' => 'term_id',
- 'terms' => $selected_terms,
+ 'terms' => $query_terms,
),
),
'fields' => 'ids',
--- a/woolentor-addons/includes/modules/variation-swatch/includes/Frontend/Woo_Config.php
+++ b/woolentor-addons/includes/modules/variation-swatch/includes/Frontend/Woo_Config.php
@@ -184,11 +184,11 @@
$image_id = '';
$product_id = $product->get_id();
- $product_meta = (array) get_post_meta( $product_id, '_swatchly_product_meta', true );
+ $product_meta = (array) Helper::get_product_swatch_meta( $product_id );
$taxonomy = $args['attribute'];
$variation_attributes = $product->get_variation_attributes();
- $meta_data = get_post_meta($product_id, '_swatchly_product_meta', true);
+ $meta_data = Helper::get_product_swatch_meta( $product_id );
$swatch_type = Helper::get_swatch_type( $taxonomy, $product_id );
$taxonomy_exists = taxonomy_exists( $taxonomy );
$tooltip = Helper::get_option('tooltip', '', 'pl');
--- a/woolentor-addons/includes/modules/variation-swatch/includes/Helper.php
+++ b/woolentor-addons/includes/modules/variation-swatch/includes/Helper.php
@@ -81,7 +81,7 @@
*/
public static function get_product_meta( $product_id, $taxonomy, $option_name = '', $default = '') {
// product override
- $product_meta = get_post_meta( $product_id, '_swatchly_product_meta', true );
+ $product_meta = self::get_product_swatch_meta( $product_id );
$meta_value = isset( $product_meta[$taxonomy][$option_name] ) && $product_meta[$taxonomy][$option_name] ? $product_meta[$taxonomy][$option_name] : $default;
@@ -95,6 +95,56 @@
*
* @return array
*/
+ /**
+ * A product's swatch overrides (_swatchly_product_meta), ready for the current language.
+ *
+ * On a translated site (WPML / Polylang):
+ * - a translated product usually has no copy of the overrides, so the ones saved on the
+ * default language product are used;
+ * - per-term overrides are keyed by term ID, and translated terms have other IDs, so each
+ * entry is also added under the term's ID in the current language.
+ * Saved keys are kept. Without a translation plugin the meta comes back unchanged.
+ *
+ * @param int $product_id
+ * @return mixed The meta as saved (string '' when unset), or the mapped array.
+ */
+ public static function get_product_swatch_meta( $product_id ) {
+ $product_meta = get_post_meta( $product_id, '_swatchly_product_meta', true );
+
+ if ( ! has_filter( 'wpml_object_id' ) ) {
+ return $product_meta;
+ }
+
+ if ( empty( $product_meta ) ) {
+ $default_language = apply_filters( 'wpml_default_language', null );
+ $original_id = $default_language ? (int) apply_filters( 'wpml_object_id', (int) $product_id, 'product', true, $default_language ) : 0;
+ if ( $original_id && $original_id !== (int) $product_id ) {
+ $product_meta = get_post_meta( $original_id, '_swatchly_product_meta', true );
+ }
+ }
+
+ if ( ! is_array( $product_meta ) ) {
+ return $product_meta;
+ }
+
+ foreach ( $product_meta as $taxonomy => $settings ) {
+ if ( ! is_array( $settings ) || empty( $settings['terms'] ) || ! is_array( $settings['terms'] ) || ! taxonomy_exists( $taxonomy ) ) {
+ continue;
+ }
+ foreach ( $settings['terms'] as $term_id => $term_meta ) {
+ if ( ! is_numeric( $term_id ) ) {
+ continue;
+ }
+ $current_id = woolentor_current_language_id( $term_id, $taxonomy );
+ if ( $current_id && ! isset( $product_meta[ $taxonomy ]['terms'][ $current_id ] ) ) {
+ $product_meta[ $taxonomy ]['terms'][ $current_id ] = $term_meta;
+ }
+ }
+ }
+
+ return $product_meta;
+ }
+
public static function get_image_sizes() {
global $_wp_additional_image_sizes;
@@ -141,7 +191,7 @@
// product override
if( $product_id ){
- $product_meta = get_post_meta( $product_id, '_swatchly_product_meta', true );
+ $product_meta = self::get_product_swatch_meta( $product_id );
$auto_convert_dropdowns_to_label = isset($product_meta['auto_convert_dropdowns_to_label']) ? $product_meta['auto_convert_dropdowns_to_label'] : '';
$swatch_type = isset( $product_meta[$taxonomy]['swatch_type'] ) && $product_meta[$taxonomy]['swatch_type'] ? $product_meta[$taxonomy]['swatch_type'] : $swatch_type;
}
--- a/woolentor-addons/includes/modules/wishlist/includes/classes/Frontend/Manage_Wishlist.php
+++ b/woolentor-addons/includes/modules/wishlist/includes/classes/Frontend/Manage_Wishlist.php
@@ -33,7 +33,8 @@
* @return [int]
*/
public function get_wishlist_page_id(){
- return absint( woolentor_get_option( 'wishlist_page', 'wishsuite_table_settings_tabs' ) );
+ // The saved page is in one language; a translated site has a copy of it per language.
+ return absint( woolentor_current_language_id( woolentor_get_option( 'wishlist_page', 'wishsuite_table_settings_tabs' ), 'page' ) );
}
/**
@@ -102,6 +103,9 @@
*/
public function add_product( $id ){
+ // If it is already saved under another language's ID, use that ID, so it isn't saved twice.
+ $id = $this->stored_product_id( $id );
+
$user_id = get_current_user_id();
$add_status = false;
@@ -229,7 +233,7 @@
* @return [mixed]
*/
public function update_product_quantity( $id, $quantity ){
- $product_id = absint( $id );
+ $product_id = $this->stored_product_id( $id );
$quantity = absint( $quantity );
if ( ! $product_id || $quantity < 1 ) {
@@ -268,6 +272,7 @@
* @return [void]
*/
public function remove_product( $id ){
+ $id = $this->stored_product_id( $id );
$user_id = get_current_user_id();
$delete_status = false;
@@ -460,13 +465,37 @@
* @return boolean
*/
public function is_product_in_wishlist( $id ) {
- $id = (string) $id;
- $list = $this->get_wishlist_products();
- if ( is_array( $list ) ) {
- return in_array( $id, $list, true );
- }else{
- return false;
+ return isset( $this->current_language_id_map()[ absint( $id ) ] );
+ }
+
+ /**
+ * [current_language_id_map] Saved wishlist IDs, keyed by the same product's ID in the current language.
+ *
+ * A product is saved under the ID of the page it was added from. On a translated site
+ * (WPML / Polylang) that may be another language, where the product has another ID.
+ * @return [array] current language id => saved id
+ */
+ public function current_language_id_map() {
+ $map = array();
+ foreach ( (array) $this->get_wishlist_products() as $saved_id ) {
+ $saved_id = absint( $saved_id );
+ $current_id = woolentor_current_language_id( $saved_id, 'product' );
+ if ( $saved_id && ! isset( $map[ $current_id ] ) ) {
+ $map[ $current_id ] = $saved_id;
+ }
}
+ return $map;
+ }
+
+ /**
+ * [stored_product_id] The ID a product is saved under in the wishlist.
+ * @param [int] $id Product ID in the current language.
+ * @return [int]
+ */
+ public function stored_product_id( $id ) {
+ $id = absint( $id );
+ $map = $this->current_language_id_map();
+ return isset( $map[ $id ] ) ? $map[ $id ] : $id;
}
/**
@@ -515,8 +544,17 @@
// Guest quantities live in the cookie, logged in ones in the wishlist table.
$guest_items = is_user_logged_in() ? array() : $this->get_guest_items();
+ // Show each product in the current language. Quantities stay under the saved ID.
+ $saved_ids = array();
+ foreach ( $ids as $saved_id ) {
+ $current_id = woolentor_current_language_id( absint( $saved_id ), 'product' );
+ if ( $current_id && ! isset( $saved_ids[ $current_id ] ) ) {
+ $saved_ids[ $current_id ] = absint( $saved_id );
+ }
+ }
+
$args = array(
- 'include' => $ids,
+ 'include' => array_keys( $saved_ids ),
'limit' => $limit,
'page' => $page
);
@@ -539,13 +577,14 @@
$average = $product->get_average_rating();
$current_product_id = $product->get_id();
+ $saved_product_id = isset( $saved_ids[ $current_product_id ] ) ? $saved_ids[ $current_product_id ] : $current_product_id;
- if ( isset( $shared_qty_map[ $current_product_id ] ) ) {
- $min_value = $shared_qty_map[ $current_product_id ];
- } elseif ( ! empty( $guest_items[ $current_product_id ] ) ) {
- $min_value = $guest_items[ $current_product_id ];
+ if ( isset( $shared_qty_map[ $saved_product_id ] ) ) {
+ $min_value = $shared_qty_map[ $saved_product_id ];
+ } elseif ( ! empty( $guest_items[ $saved_product_id ] ) ) {
+ $min_value = $guest_items[ $saved_product_id ];
} else {
- $get_row = WishSuiteManage_Data::instance()->read_single_item( get_current_user_id(), $current_product_id );
+ $get_row = WishSuiteManage_Data::instance()->read_single_item( get_current_user_id(), $saved_product_id );
if( is_object( $get_row ) && $get_row->quantity ){
$min_value = $get_row->quantity;
}else{
--- a/woolentor-addons/includes/modules/wishlist/includes/helper-functions.php
+++ b/woolentor-addons/includes/modules/wishlist/includes/helper-functions.php
@@ -50,7 +50,7 @@
*/
function wishsuite_get_page_url() {
$page_id = woolentor_get_option( 'wishlist_page', 'wishsuite_table_settings_tabs' );
- return get_permalink( $page_id );
+ return get_permalink( woolentor_current_language_id( $page_id, 'page' ) );
}
/**
--- a/woolentor-addons/woolentor-blocks/build/blocks/brand-logo/index.php
+++ b/woolentor-addons/woolentor-blocks/build/blocks/brand-logo/index.php
@@ -54,7 +54,7 @@
if( is_array( $brands ) ){
if( $settings['slider'] === true ){
- echo '<div id="'.esc_attr("product-slider-" . $settings['blockUniqId']).'" dir="'.esc_attr($direction).'" class="product-slider" data-settings='' . wp_json_encode( $slider_settings ) . '' style="display:none">';
+ echo '<div id="'.esc_attr("product-slider-" . $settings['blockUniqId']).'" dir="'.esc_attr($direction).'" class="product-slider" data-settings="' . esc_attr( wp_json_encode( $slider_settings ) ) . '" style="display:none">';
}else{
echo '<div class="woolentor-grid '.( $settings['noGutter'] === true ? 'woolentor-no-gutters' : '' ).'">';
}
--- a/woolentor-addons/woolentor-blocks/build/blocks/category-grid/index.php
+++ b/woolentor-addons/woolentor-blocks/build/blocks/category-grid/index.php
@@ -85,7 +85,7 @@
];
$slider_settings = array_merge( $slider_settings, $slider_responsive_settings );
- $sliderOptions = 'data-settings='.wp_json_encode( $slider_settings );
+ $sliderOptions = 'data-settings="'.esc_attr( wp_json_encode( $slider_settings ) ).'"';
}else{
$sliderOptions = '';
$direction = '';
--- a/woolentor-addons/woolentor-blocks/build/blocks/faq/index.php
+++ b/woolentor-addons/woolentor-blocks/build/blocks/faq/index.php
@@ -17,11 +17,11 @@
$accordion_settings = [
'showitem' => ( $settings['showFirstItem'] === true ),
];
-$dataOptions = 'data-settings='.wp_json_encode( $accordion_settings );
+$dataOptions = wp_json_encode( $accordion_settings );
?>
<div class="<?php echo esc_attr(implode(' ', $areaClasses )); ?>">
- <div class="<?php echo esc_attr(implode(' ', $classes )); ?>" id="<?php echo esc_attr('htwoolentor-faq-'.$settings['blockUniqId']); ?>" <?php echo esc_attr($dataOptions); ?>>
+ <div class="<?php echo esc_attr(implode(' ', $classes )); ?>" id="<?php echo esc_attr('htwoolentor-faq-'.$settings['blockUniqId']); ?>" data-settings="<?php echo esc_attr( $dataOptions ); ?>">
<?php
foreach ( $settings['faqList'] as $item ):
--- a/woolentor-addons/woolentor-blocks/build/blocks/product-tab/index.php
+++ b/woolentor-addons/woolentor-blocks/build/blocks/product-tab/index.php
@@ -199,7 +199,7 @@
<?php else:?>
<div class="woolentor-grid <?php echo ( $proslider == 'yes' ) ? 'woolentor-grid-slider' : ''; ?>">
- <?php if( $proslider == 'yes' ){ echo '<div id="product-slider-' . esc_attr($settings['blockUniqId
Frequently Asked Questions
What is CVE-2026-132227?
Vulnerability overviewCVE-2026-132227 is a stored cross-site scripting vulnerability in the ShopLentor plugin for WordPress, affecting versions up to and including 3.5.9. It allows an authenticated user with Author-level access or higher to inject arbitrary JavaScript into pages through the customlabel_days parameter in countdown widgets. The injected script executes in the browser of any user who views the affected page.
How does the vulnerability work technically?
Root causeThe countdown widget rendering functions pass the custom label values into a JSON string that is embedded in a data-customlavel attribute without proper attribute escaping. Because the attribute was enclosed in single quotes and the JSON was not escaped for HTML attribute context, an attacker can inject a single quote followed by JavaScript to break out of the attribute. The patch adds sanitize_text_field() on input and esc_attr() on output to prevent this breakout.
Who is affected by this vulnerability?
Affected installationsAny WordPress site running ShopLentor version 3.5.9 or earlier is affected. Exploitation additionally requires Elementor to be active and a WooCommerce product on sale with an active sale end date included in the widget query, so that the countdown block renders. Sites without these components or without Author-level users are at reduced practical risk.
How can I check if my site is vulnerable?
Detection stepsConfirm the installed ShopLentor version in the WordPress plugins list or via WP-CLI with wp plugin list. If the version is 3.5.9 or lower, verify that Elementor is active and that countdown widgets are used on pages with on-sale products. Review user accounts for Author-level or higher access that may not be trusted.
What is the fixed version and how do I update?
RemediationThe vulnerability is patched in ShopLentor version 3.6.0. Administrators should update the plugin through the WordPress dashboard or WP-CLI as soon as possible. After updating, verify the installed version and confirm that countdown widgets still render correctly on affected pages.
What does the CVSS score of 6.4 mean in practice?
Risk interpretationA CVSS score of 6.4 indicates medium severity. The score reflects that exploitation requires authenticated access at Author level and specific conditions such as an active Elementor page with a qualifying on-sale product. While not remotely exploitable by anonymous users, the impact on visitors and administrators who view the injected page can still be significant.
What can an attacker do with this vulnerability?
Potential impactAn attacker with Author-level access can store JavaScript that executes in the browsers of users viewing the affected page. This can lead to cookie theft, session hijacking, redirection to malicious sites, content defacement, or other client-side attacks. Because the script runs in the context of the victim’s session, it may be used to target administrators or other privileged users.
How does the proof of concept demonstrate the issue?
PoC explanationThe proof of concept shows how an authenticated Author-level user could set the customlabel_days parameter to a payload such as a single quote followed by JavaScript. When the countdown widget renders for a qualifying on-sale product, the payload breaks out of the data-customlavel attribute and executes. The PoC is conceptual and requires interaction with the Elementor editor to store the payload in widget settings.
Are there mitigations if I cannot update immediately?
Interim controlsIf immediate updating is not possible, restrict Author-level and higher accounts to trusted users only. Consider disabling or removing countdown widgets that use custom labels until the plugin is patched. A web application firewall rule targeting suspicious characters in widget parameters may provide limited additional protection but should not replace the update.
Does the patch address other related issues?
Patch scopeYes. In addition to the countdown widgets, the patch applies esc_attr() to JSON data in attributes across other widgets including compare-table, product-tabs, category-grid, recently-viewed, ajax-search, and badges. It also adds sanitization and validation to the Load More and Infinite Scroll settings handling in the AJAX actions class.
Why is authentication required for exploitation?
Access requirementsThe vulnerable parameter is stored through the Elementor widget settings, which requires a user account with at least Author-level access to edit content. This requirement limits the attack surface because an anonymous visitor cannot directly inject the payload. However, Author-level accounts are sometimes granted broadly, so site owners should review who holds this role.
What should I do if I suspect exploitation?
Incident responseReview pages and posts containing countdown widgets for unexpected script content or modified widget settings. Check user accounts for unauthorized Author-level or higher access and rotate credentials if compromise is suspected. Update to ShopLentor 3.6.0 and scan the site for additional indicators of compromise.
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.
Trusted by Developers & Organizations






