Created
February 8, 2022 17:54
-
-
Save trueqap/2561944bfec98c0f19713c93607fb0c6 to your computer and use it in GitHub Desktop.
replace_variation_single_price.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function replace_variation_single_price() | |
{ | |
?> | |
<style> | |
.woocommerce-variation-price { | |
display: none; | |
} | |
</style> | |
<script> | |
jQuery(document).ready(function($) { | |
var priceselector = '.product p.price'; | |
var originalprice = $(priceselector).html(); | |
$( document ).on('show_variation', function() { | |
$(priceselector).html($('.single_variation .woocommerce-variation-price').html()); | |
}); | |
$( document ).on('hide_variation', function() { | |
$(priceselector).html(originalprice); | |
}); | |
}); | |
</script> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment