woocommerce_get_cart_item_from_session

woocommerce_get_cart_item_from_session

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

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_get_cart_item_from_session') is found 1 times:

  • /includes/class-wc-cart-session.php line 219
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    * @param array  $session_data Data for an item in the cart.
     * @param array  $values       Data for an item in the cart, without the product object.
     * @param string $key          The cart item hash.
     */
    $cart_contents[ $key ] = apply_filters( 'woocommerce_get_cart_item_from_session', $session_data, $values, $key );
    if ( ! isset( $cart_contents[ $key ]['data'] ) || ! $cart_contents[ $key ]['data'] instanceof WC_Product ) {
        // If the cart contents is missing the product object after filtering, something is wrong.
        wc_doing_it_wrong(
            __METHOD__,
            'When filtering cart items with woocommerce_get_cart_item_from_session, each item must have a data key containing a product object.',
            '9.8.0'