1
votes

I don't want to have customers get the "...has been removed from your cart because it can no longer be purchased..." WooCommerce message when a product that was in their cart get's removed from the online shop.

1

1 Answers

0
votes

Try adding the following code in your theme's functions.php

// Remove the "order again" button
remove_action( 'woocommerce_order_details_after_order_table', 'woocommerce_order_again_button' );

// woocommerce remove message (en&es): [Item] has been removed from your cart because it can no longer be purchased. Please contact us for assistance.

function customize_wc_errors( $error ) {
    if ( strpos( $error, 'has been removed from your cart because' ) !== false ) {
        return '';
    } else if ( strpos( $error, 'ha sido eliminado de tu carrito ya que no' ) !== false ) {
        return '';
    } else {
        return $error; 
    }
}
add_filter( 'woocommerce_add_error', 'customize_wc_errors' );