// 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' );
2条答案
按热度按时间kcugc4gi1#
或者,您可以挂钩到特定的错误消息过滤器,捕获所有可能的翻译,并清空消息以防止其显示。
就像这样:
woocommerce_cart_item_removed_message
过滤器挂钩是唯一的此错误,并在wp-content/plugins/woocommerce/includes/class-wc-cart-session.php
中定义的第142行(WooCommerce版本6.2.1)。4c8rllxm2#
尝试在主题的functions.php中添加以下代码