WC_Gateway_Paypal_Request::get_order_item_names()
Get order item names as a string.
Method of the class: WC_Gateway_Paypal_Request{}
Hooks from the method
Return
String
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_order_item_names( $order );
- $order(WC_Order) (required)
- Order object.
WC_Gateway_Paypal_Request::get_order_item_names() WC Gateway Paypal Request::get order item names code WC 8.3.0
protected function get_order_item_names( $order ) { $item_names = array(); foreach ( $order->get_items() as $item ) { $item_name = $item->get_name(); $item_meta = wp_strip_all_tags( wc_display_item_meta( $item, array( 'before' => '', 'separator' => ', ', 'after' => '', 'echo' => false, 'autop' => false, ) ) ); if ( $item_meta ) { $item_name .= ' (' . $item_meta . ')'; } $item_names[] = $item_name . ' x ' . $item->get_quantity(); } return apply_filters( 'woocommerce_paypal_get_order_item_names', implode( ', ', $item_names ), $order ); }