2016-06-09 2 views
2

나는 Woocommerce 소스 코드에서이 필터가 있습니다Woocommerce 필터 정의 (바닥 대 반올림)

$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)); 

내가 내 필터이 변경 사항을 적용 할을하지만 난 방법을 이해할 수 없습니다.

$this->total = max(0, apply_filters('woocommerce_calculated_total', floor(($this->cart_contents_total + $this->tax_total + $this->shipping_tax_total + $this->shipping_total + $this->fee_total) * 100)/100, $this)); 

도움이 되겠습니다. 인사!

답변

2

완료!

function custom_round_function($total, $cart) { 

$total = floor(($cart->cart_contents_total + $cart->tax_total + $cart->shipping_tax_total + $cart->shipping_total + $cart->fee_total) * 100)/100; 

return $total; 
} 

add_filter('woocommerce_calculated_total', 'custom_round_function', 10, 2);