WC_Abstract_Order::get_items_key( string $item )

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


Description Description


Parameters Parameters

$item

(Required) object Order item (product, shipping, fee, coupon, tax).


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/abstracts/abstract-wc-order.php

914
915
916
917
918
919
920
921
922
923
924
925
926
927
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 );
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.