WC_Gateway_Paypal_Request::prepare_line_items( WC_Order $order )
Get line items to send to paypal.
Description Description
Parameters Parameters
- $order
-
(Required) Order object.
Source Source
File: includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php
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 ); } } }