0

I have a price block for every single product page in the WooCommerce project. Like Cash Price, COD Price, PayPal, Stripe, etc.

enter image description here

Here what I want is to change this pricing based on the selected variation. Ex: I have capacities like 32GB, 64GB, 128GB. So, change this price block based on the selected variation.

Therefore I tried to add an action where I can trigger the event when variations were added. But I can't see that action is working. This is my action code to trigger when variation is selected and price changes. But I can't see this alert in firing.

function change_pricing_block() {
    ?>
    <script>
    $( ".variations_form" ).on( "woocommerce_variation_select_change", function () {
        alert('variation');
    });
    </script>
    <?php
}
add_action( 'wp_footer', 'change_pricing_block' );

Can anybody help me with this?

Thanks in advance

WP Learner
  • 788
  • 1
  • 13
  • 34

0 Answers0