Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 根据Woocommerce结帐中的购物车总数更改支付网关选项_Php_Wordpress_Woocommerce_Stripe Payments_Payment Gateway - Fatal编程技术网

Php 根据Woocommerce结帐中的购物车总数更改支付网关选项

Php 根据Woocommerce结帐中的购物车总数更改支付网关选项,php,wordpress,woocommerce,stripe-payments,payment-gateway,Php,Wordpress,Woocommerce,Stripe Payments,Payment Gateway,对于我的woocommerce商店,我在functions.php中有这个过滤器。它强制3DS使用“woocommerce Stripe Gateway”插件 它工作得很好 我希望此过滤器仅对超过50欧元的订单有效 我尝试过这个,但它不起作用,订单在没有3DS的情况下被验证 $minsecure = 50; $order = new WC_Order( $order_id ); $total = $order->get_total(); if($total

对于我的woocommerce商店,我在functions.php中有这个过滤器。它强制3DS使用“woocommerce Stripe Gateway”插件

它工作得很好

我希望此过滤器仅对超过50欧元的订单有效

我尝试过这个,但它不起作用,订单在没有3DS的情况下被验证

    $minsecure = 50;
    $order = new WC_Order( $order_id );
    $total = $order->get_total();

    if($total>$minsecure) { 
          add_filter('wc_stripe_require_3ds','__return_true');
    }
我还尝试获取购物车金额,而不是订单金额,但我不知道在“订单”单击和确认页面之间要激活哪个过滤器


非常感谢您的帮助。

我会用这个来检查订单的价格是否超过50英镑

if( WC()->cart->subtotal > 50 )
所以这个片段看起来像

add_action('woocommerce_cart_updated', 'wc_stripe_require_3ds', 90);
function wc_stripe_require_3ds ( $cart ){
    if( WC()->cart->subtotal > 50 ) {
        add_filter('wc_stripe_require_3ds','__return_true');
    }
}

试一试。

它工作得非常好,我对您的响应能力印象深刻,非常满意,我已经寻找了几个小时的解决方案。非常感谢。欢迎您访问,对于所有关于WooCommerce@LoicTheAztec的问题,我都很高兴,但如果有时间我能帮忙的话;-)
add_action('woocommerce_cart_updated', 'wc_stripe_require_3ds', 90);
function wc_stripe_require_3ds ( $cart ){
    if( WC()->cart->subtotal > 50 ) {
        add_filter('wc_stripe_require_3ds','__return_true');
    }
}