Answer the question
In order to leave comments, you need to log in
Correct final price hook for WooCommerce?
Good day of the day.
In the class-wc-cart.php file, on line 1401+, there is a code that is included in the calculate_totals() function:
$this->total = max( 0, apply_filters( 'woocommerce_calculated_total', round( $this->cart_contents_total + $this->tax_total + $this->shipping_tax_total + $this->shipping_total + $this->fee_total, $this->dp ), $this ) );
Answer the question
In order to leave comments, you need to log in
The filter is built like this woocommerce_calculated_total :
// The following example is for adding a hook callback.
// define the woocommerce_calculated_total callback
function filter_woocommerce_calculated_total( $round, $instance ) {
// make filter magic happen here...
return $round;
};
// add the filter
add_filter( 'woocommerce_calculated_total', 'filter_woocommerce_calculated_total', 10, 2 );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question