Thread Starter
blghna
(@blghna)
Thank you for getting back to me. I’ve solved the problem using a similar approach. Have a good day!
I’m attaching the script below for those who might encounter a similar issue.
<script>
jQuery(document).ready(function($) {
var targetNode = document.querySelector('.single_add_to_cart_button');
var observer = new MutationObserver(function(mutationsList, observer) {
for (var mutation of mutationsList) {
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
if ($(mutation.target).hasClass('added')) {
$('.single_add_to_cart_button').hide();
$('.added_to_cart').addClass('btn').show();
}
}
}
});
observer.observe(targetNode, { attributes: true });
});
</script>
-
This reply was modified 1 year, 11 months ago by blghna.