woocommerce_remove_cart_item_from_session

woocommerce_remove_cart_item_from_session

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

do_action('woocommerce_remove_cart_item_from_session') is found 3 times:

  • /includes/class-wc-cart-session.php line 163
    				 * @param string     $key Cart item key.
    				 * @param array      $values Cart item values e.g. quantity and product_id.
    				 * @param WC_Product $product The product being added to the cart.
    				 */
    				do_action( 'woocommerce_remove_cart_item_from_session', $key, $values, $product );
    
    				/**
    				 * Allow 3rd parties to override this item's is_purchasable() result with cart item data.
    				 *
    				 * @param bool       $is_purchasable If false, the item will not be added to the cart. Default: product's is_purchasable() status.
    				 * @param string     $key Cart item key.
    
  • /includes/class-wc-cart-session.php line 188
    				 * @param WC_Product $product Product data.
    				 */
    				$message = apply_filters( 'woocommerce_cart_item_removed_message', $message, $product );
    				wc_add_notice( $message, 'error' );
    				do_action( 'woocommerce_remove_cart_item_from_session', $key, $values );
    
    			} elseif ( ! empty( $values['data_hash'] ) && ! hash_equals( $values['data_hash'], wc_get_cart_item_data_hash( $product ) ) ) { // phpcs:ignore PHPCompatibility.PHP.NewFunctions.hash_equalsFound
    				$update_cart_session = true;
    				/* translators: %1$s: product name. %2$s product permalink */
    				$message = sprintf( __( '%1$s has been removed from your cart because it has since been modified. You can add it back to your cart <a href="%2$s">here</a>.', 'woocommerce' ), $product->get_name(), $product->get_permalink() );
    				$message = apply_filters( 'woocommerce_cart_item_removed_because_modified_message', $message, $product );
    
  • /includes/class-wc-cart-session.php line 196
    				/* translators: %1$s: product name. %2$s product permalink */
    				$message = sprintf( __( '%1$s has been removed from your cart because it has since been modified. You can add it back to your cart <a href="%2$s">here</a>.', 'woocommerce' ), $product->get_name(), $product->get_permalink() );
    				$message = apply_filters( 'woocommerce_cart_item_removed_because_modified_message', $message, $product );
    				wc_add_notice( $message, 'notice' );
    				do_action( 'woocommerce_remove_cart_item_from_session', $key, $values );
    
    			} else {
    				// Put session data into array. Run through filter so other plugins can load their own session data.
    				$session_data = array_merge(
    					$values,
    					array(