Set price through hook is not working anymore
-
Hello support,
The price change with this hook is not working anymore, is there any alternatives?
add_action( 'woocommerce_before_calculate_totals', 'set_item_cart_prices', 20, 1 ); function set_item_cart_prices( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; // Loop through cart items foreach ( $cart->get_cart() as $cart_item ){ if( ! is_user_logged_in() ){ $cart_item['data']->set_price( $cart_item['data']->get_regular_price() ); } } }
It was working before but it is not working anymore.
Please suggest.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Set price through hook is not working anymore’ is closed to new replies.