Reputation: 157
Is there any way to change the line_total
and line_subtotal
in WooCommerce once an order is in add to cart.
Thanks in advance.
Upvotes: 2
Views: 3308
Reputation: 3634
There two hook for check out page where you can modify line total and line sub total. woocommerce_calculate_totals
function action_woocommerce_calculate_totals( $fee ) {
// add your logic
};
// add the action
add_action('woocommerce_calculate_totals','action_woocommerce_calculate_totals', 10, 1 );
woocommerce_cart_subtotal
function filter_woocommerce_cart_subtotal( $array, $int, $int ) {
// implement your logic
return $array;
};
// add the filter
add_filter( 'woocommerce_cart_subtotal', 'filter_woocommerce_cart_subtotal', 10, 3 );
Upvotes: 1