I’m a biginner with woocommerce , in my site I’d like to add in the cart page a select input where the user can select a value between two options. and depending on this value I will change the price.

so far, I could get the total and change it using this :

function action_woocommerce_before_cart_totals(  ) { 
 global $woocommerce;

 $woocommerce->cart->total  = $woocommerce->cart->total*0.25;
   var_dump( $woocommerce->cart->total);}; 

the issue is that when I go to checkout page it doesn’t take the total calculated in functions.php

thanks for helping me.

Read more here: woocommerce change price in checkout and cart page


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: