woocommerce_cart_contents_changed

woocommerce_cart_contents_changed

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

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_cart_contents_changed') is found 3 times:

  • /includes/class-wc-cart-session.php line 239
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    }
     
    // If it's not empty, it's been already populated by the loop above.
    if ( ! empty( $cart_contents ) ) {
        $this->cart->set_cart_contents( apply_filters( 'woocommerce_cart_contents_changed', $cart_contents ) );
    }
     
    do_action( 'woocommerce_cart_loaded_from_session', $this->cart );
     
    if ( $update_cart_session || is_null( WC()->session->get( 'cart_totals', null ) ) ) {
        WC()->session->set( 'cart', $this->get_cart_for_session() );
  • /includes/class-wc-cart.php line 1299
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
                $cart_item_key
            );
        }
     
        $this->cart_contents = apply_filters( 'woocommerce_cart_contents_changed', $this->cart_contents );
     
        do_action( 'woocommerce_add_to_cart', $cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data );
     
        return $cart_item_key;
     
    } catch ( Exception $e ) {
  • /src/StoreApi/Utilities/CartController.php line 183
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    *
     * @param array $cart_contents Array of all cart items.
     * @return array Updated array of all cart items.
     */
    $cart->cart_contents = apply_filters( 'woocommerce_cart_contents_changed', $cart->cart_contents );
     
    /**
     * Fires when an item is added to the cart.
     *
     * This hook fires when an item is added to the cart. This is triggered from the Store API in this context, but
     * WooCommerce core add to cart events trigger the same hook.