skip to Main Content

Get cart subtotal in woocommerce_before_calculate_totals hook

I want to get cart contents total in woocommerce within woocommerce_before_calculate_totals hook. So to achieve this I am using this code add_action( 'woocommerce_before_calculate_totals', 'get_before_calculate_totals', 10 ); function get_before_calculate_totals( $cart_object ) { global $woocommerce; echo WC()->cart->get_cart_contents_total(); //returns 0 } But it…

VIEW QUESTION

WooCommerce cart quantity won't change after cart update

I use the following snippet to change WooCommerce add to cart quantity rules. add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 10, 2 ); function custom_quantity_input_args( $args, $product ) { $custom_qty_product_ids = array(27345, 27346); if (!in_array($product->get_id(), $custom_qty_product_ids)) { $args['input_value'] = 25; $args['max_value'] = 500; $args['min_value']…

VIEW QUESTION
Back To Top
Search