• Resolved paulwessiack

    (@paulwessiack)


    Currently we are using the Stripe plugin from WooCommerce but we want to switch to your plugin because of the Klarna support.

    We need to hide the ApplePay and google Pay buttons for our B2B customers because for them additional informations are needed to be collected during checkout out.

    We do that with this code in functions.php:

    //hide Stripe Apple and Google Pay button on cart page
    add_filter( 'wc_stripe_show_payment_request_on_cart', 'wc_stripe_show_payment_request_on_cart_for_non_wholesale_users' );
    function wc_stripe_show_payment_request_on_cart_for_non_wholesale_users( $show_payment ) {
        global $wc_wholesale_prices;
        $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole();
    
        if ( ! empty( $user_wholesale_role ) ) {
            $show_payment = false;
        }
    
        return $show_payment;
    }

    does your plugin have a filter to disable the ApplePay button which works the same like the WooCommerce Stripe plugin?

    thanks

    :: Paul

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @paulwessiack,

    does your plugin have a filter to disable the ApplePay button which works the same like the WooCommerce Stripe plugin?

    Yes, there are filters you can use to conditionally disable the payment buttons.

    Filters:

    wc_stripe_product_payment_methods – for controlling product page buttons.

    wc_stripe_cart_payment_methods – for controlling cart page buttons.

    Example:

    add_filter('wc_stripe_product_payment_methods', function($payment_methods){
        if ( ! empty( $user_wholesale_role ) ) {
            unset($payment_methods['stripe_applepay'];
            unset($payment_methods['stripe_googlepay'];
        }
        return $payment_methods;
    });

    Kind Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Hide ApplePay button on product detail page’ is closed to new replies.