Skip to content

Instantly share code, notes, and snippets.

@trueqap
Created February 8, 2022 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trueqap/2561944bfec98c0f19713c93607fb0c6 to your computer and use it in GitHub Desktop.
Save trueqap/2561944bfec98c0f19713c93607fb0c6 to your computer and use it in GitHub Desktop.
replace_variation_single_price.php
<?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