woocommerce_get_item_data

woocommerce_get_item_data

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

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_get_item_data') is found 2 times:

  • /includes/wc-template-functions.php line 3855
    		}
    	}
    
    	// 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 102
    		 * @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 ) {