woocommerce_get_item_data

woocommerce_get_item_data

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_get_item_data') is found 2 times:

  • /includes/wc-template-functions.php line 4113
    4109
    4110
    4111
    4112
    4113
    4114
    4115
    4116
    4117
    4118
    4119
        }
    }
     
    // Filter item data to allow 3rd parties to add more to the array.
    $item_data = apply_filters( 'woocommerce_get_item_data', $item_data, $cart_item );
     
    if ( is_array( $item_data ) ) {
        // Format item data ready to display.
        foreach ( $item_data as $key => $data ) {
            // Set hidden to true to not display meta on cart.
            if ( ! empty( $data['hidden'] ) ) {
  • /src/StoreApi/Schemas/V1/CartItemSchema.php line 169
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    * @param array $item_data Cart item data. Empty by default.
     * @param array $cart_item Cart item array.
     * @return array
     */
    $item_data       = apply_filters( 'woocommerce_get_item_data', array(), $cart_item );
    $clean_item_data = [];
    foreach ( $item_data as $data ) {
        // We will check each piece of data in the item data element to ensure it is scalar. Extensions could add arrays
        // to this, which would cause a fatal in wp_strip_all_tags. If it is not scalar, we will return an empty array,
        // which will be filtered out in get_item_data (after this function has run).
        foreach ( $data as $data_value ) {