New hook: cart item removed because of hash change

This commit is contained in:
Žygimantas Arūna 2021-11-14 16:42:55 +02:00 committed by Peter Fabian
parent af3c2732c1
commit db6f6f22ca
1 changed files with 3 additions and 1 deletions

View File

@ -146,7 +146,9 @@ final class WC_Cart_Session {
} 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 */
wc_add_notice( 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() ), 'notice' );
$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 {