WordPress at Your Fingertips
function is not described

WC_Checkout::set_data_from_cart() public WC 1.0

Copy line items, tax, totals data from cart to order.

{} It's a method of the class: WC_Checkout{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Checkout = new WC_Checkout();
$WC_Checkout->set_data_from_cart( $order );
$order(WC_Order) (required) (passed by reference — &)
Order object.

Code of WC_Checkout::set_data_from_cart() WC 5.9.0

public function set_data_from_cart( &$order ) {
	$order_vat_exempt = WC()->cart->get_customer()->get_is_vat_exempt() ? 'yes' : 'no';
	$order->add_meta_data( 'is_vat_exempt', $order_vat_exempt, true );
	$order->set_shipping_total( WC()->cart->get_shipping_total() );
	$order->set_discount_total( WC()->cart->get_discount_total() );
	$order->set_discount_tax( WC()->cart->get_discount_tax() );
	$order->set_cart_tax( WC()->cart->get_cart_contents_tax() + WC()->cart->get_fee_tax() );
	$order->set_shipping_tax( WC()->cart->get_shipping_tax() );
	$order->set_total( WC()->cart->get_total( 'edit' ) );
	$this->create_order_line_items( $order, WC()->cart );
	$this->create_order_fee_lines( $order, WC()->cart );
	$this->create_order_shipping_lines( $order, WC()->session->get( 'chosen_shipping_methods' ), WC()->shipping()->get_packages() );
	$this->create_order_tax_lines( $order, WC()->cart );
	$this->create_order_coupon_lines( $order, WC()->cart );
}