WordPress at a glance
function is not described

WC_Abstract_Order::get_items_key() protected WC 3.0.0

Get key for where a certain item type is stored in _items.

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

Hooks from the method
Return

String. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_items_key( $item );
$item(string) (required)
object Order item (product, shipping, fee, coupon, tax).

Changelog

Since 3.0.0 Introduced.

Code of WC_Abstract_Order::get_items_key() WC 5.3.0

<?php
protected function get_items_key( $item ) {
	if ( is_a( $item, 'WC_Order_Item_Product' ) ) {
		return 'line_items';
	} elseif ( is_a( $item, 'WC_Order_Item_Fee' ) ) {
		return 'fee_lines';
	} elseif ( is_a( $item, 'WC_Order_Item_Shipping' ) ) {
		return 'shipping_lines';
	} elseif ( is_a( $item, 'WC_Order_Item_Tax' ) ) {
		return 'tax_lines';
	} elseif ( is_a( $item, 'WC_Order_Item_Coupon' ) ) {
		return 'coupon_lines';
	}
	return apply_filters( 'woocommerce_get_items_key', '', $item );
}