Hi,
I’ve just taken over maintenance of a website that has Enfold 4.7.4 installed and is in desperate need of updates. They have the following script in functions.php to remove the ecommerce sales badge, I presume. When I upgrade to 4.9.2.3 will this script need to be replaced? If so, what would it need to be? Thank you.
// Removing sales badge
// custom script
add_action(‘wp_footer’, ‘ava_custom_script’);
function ava_custom_script(){
?>
<script>
(function($){
function h() {
$(‘#top .product’).each(function() {
var onsale = $(this).find(‘.onsale’),
thumb = $(this).find(‘.woocommerce-LoopProduct-link’);
onsale.appendTo(thumb);
});
}
h();
})(jQuery);
</script>
<?php
}
Hey GWS,
If it’s added in a child theme, then it should be safe. If it’s added in the parent theme, then it would have to be added back after the update. Please make sure to have backups of the site before you start updating.
Best regards,
Rikard
if i read the script well – and if i test it via developer Konsole on https://kriesi.at/themes/enfold-shop/
this will not remove the Sale badge but move it from bottom right to top right place.
PS : i only do not know for what the function h() is inserted
Guess this will be enough :
function ava_custom_script(){
?>
<script>
(function($){
$('#top .product').each(function() {
var onsale = $(this).find('.onsale'),
thumb = $(this).find('.woocommerce-LoopProduct-link');
onsale.appendTo(thumb);
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'ava_custom_script');
Rikard, thank you for your response. We’ve upgraded the site to the latest version of Enfold without issue.
Guenni007, thank you for your suggestion. I’ve noted it and will test it out.
For now, all is well. Please consider this topic closed.
Hi,
Glad to hear that you have this sorted out, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike