如何删除“ {Product}已从您的购物车中删除,因为无法再购买。” WooCommerce中的消息?

时间:2019-04-12 20:37:12

标签: wordpress woocommerce

我不希望客户收到“ ...已从购物车中删除,因为无法再购买...”,当购物车中的产品从网上商店中删除时,WooCommerce消息

1 个答案:

答案 0 :(得分:0)

尝试在主题的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' );