如何解决Paypal Express结帐隐藏自定义错误消息
我正在为我的Woocommerce商店使用Paypal Express结帐。我们提供披萨,所以我需要在“结帐”页面中检查订单的总金额,并且当客户尝试下单的总金额少于其邮政编码的最小订单金额时,需要向客户发送错误消息。
我可以通过以下代码构建此功能。
add_action( 'woocommerce_checkout_process','required_min_cart_subtotal_amount');
// Only run in the Checkout pages
function required_min_cart_subtotal_amount() {
if( is_checkout() ) {
global $woocommerce;
// Set the minimum order amount and shipping zone before checking out
$minimum = 12;
$county1 = array(000001);
$county2 = array(000002);
// Defining var total amount
$cart_tot_order = WC()->cart->total;
if( $cart_tot_order < 8 && in_array( WC()->customer->get_shipping_postcode(),$county1 ) ) {
// Display error message
wc_add_notice( sprintf( '<strong>A minimum order of $% s is required to ship to your address.</strong>'
. '<br />Current order: $%s.',8,$cart_tot_order ),'error' );
} elseif( $cart_tot_order < 10 && in_array( WC()->customer->get_shipping_postcode(),$county2) ) {
// Display error message
wc_add_notice( sprintf( '<strong>A minimum order of $% s is required to ship to your address.</strong>'
. '<br />Current order: $%s.',10,'error' );
}
}
问题是,当用户选择Paypal Express时,则不显示自定义错误消息,仅出现红线。 在Paypal打开其模式之前,如何显示自定义消息?
谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。