WC_REST_Paypal_Standard_Controller::recompute_feesprivateWC 1.0

Recompute the fees for the order.

Method of the class: WC_REST_Paypal_Standard_Controller{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->recompute_fees( $order );
$order(WC_Order) (required)
The order object.

WC_REST_Paypal_Standard_Controller::recompute_fees() code WC 10.3.6

private function recompute_fees( $order ) {
	WC()->cart->calculate_fees();
	WC()->cart->calculate_shipping();
	WC()->cart->calculate_totals();

	$order->remove_order_items();
	WC()->checkout->set_data_from_cart( $order );
	$order->save();
}