Hi,
Please try following code snippet:
add_action( 'wp_enqueue_scripts', 'aws_wp_enqueue_scripts', 999 );
function aws_wp_enqueue_scripts() {
$script = '
function aws_results_html( html, options ) {
var matches = html.matchAll(/(<li[\s\S]*?)<\/li>/ig);
var newHtml = "";
if ( matches ) {
for (const match of matches) {
if ( ! match[0].includes("aws_result_item") && ! match[0].includes("aws_result_sale") ) {
newHtml += match[0];
} else {
newHtml += match[0].replace("aws_result_item", "aws_result_item is_on_sale");
}
}
}
return "<ul>" + newHtml + "</ul>";
}
AwsHooks.add_filter( "aws_results_html", aws_results_html );
';
wp_add_inline_script( 'aws-script', $script);
wp_add_inline_script( 'aws-pro-script', $script);
}
You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.
Also, after adding this code you will need to go to the plugin settings page and click the ‘Clear cache’ button.
Also – inside plugin settings page option ‘Show sale badge’ must be enabled.
Regards