woocommerce_add_cart_item_data

woocommerce_add_cart_item_data

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_add_cart_item_data') is found 1 times:

  • /includes/class-wc-cart.php line 1146
    				throw new Exception( sprintf( __( 'The selected product isn\'t a variation of %2$s, please choose product options by visiting <a href="%1$s" title="%2$s">%2$s</a>.', 'woocommerce' ), esc_url( $product->get_permalink() ), esc_html( $product->get_name() ) ) );
    			}
    
    			// Load cart item data - may be added by other plugins.
    			$cart_item_data = (array) apply_filters( 'woocommerce_add_cart_item_data', $cart_item_data, $product_id, $variation_id, $quantity );
    
    			// Generate a ID based on product ID, variation ID, variation data, and other cart item data.
    			$cart_id = $this->generate_cart_id( $product_id, $variation_id, $variation, $cart_item_data );
    
    			// Find the cart item key in the existing cart.
    			$cart_item_key = $this->find_product_in_cart( $cart_id );
    

See this hook used in plugins: