woocommerce_cart_contents_changed

woocommerce_cart_contents_changed

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

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_cart_contents_changed') is found 3 times:

  • /includes/class-wc-cart-session.php line 216
    		}
    
    		// 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 1284
    					$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 146
    		 *
    		 * @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.