WordPress at Your Fingertips
function is not described

WC_Gateway_Paypal_Request::prepare_line_items() protected WC 1.0

Get line items to send to paypal.

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

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_line_items( $order );
$order(WC_Order) (required)
Order object.

Code of WC_Gateway_Paypal_Request::prepare_line_items() WC 5.7.0

protected function prepare_line_items( $order ) {
	$this->delete_line_items();

	// Products.
	foreach ( $order->get_items( array( 'line_item', 'fee' ) ) as $item ) {
		if ( 'fee' === $item['type'] ) {
			$item_line_total = $this->number_format( $item['line_total'], $order );
			$this->add_line_item( $item->get_name(), 1, $item_line_total );
		} else {
			$product         = $item->get_product();
			$sku             = $product ? $product->get_sku() : '';
			$item_line_total = $this->number_format( $order->get_item_subtotal( $item, false ), $order );
			$this->add_line_item( $this->get_order_item_name( $order, $item ), $item->get_quantity(), $item_line_total, $sku );
		}
	}
}