Skip to content

Apple Pay integration bypasses WooCommerce "Enable guest checkout" setting #359

Open

Description

@sidedwards

I have guest checkout disabled in my WooCommerce settings.

Screen Shot 2019-11-21 at 6 21 05 PM

However, when I create orders through Apple Pay, it allows guest checkout.

Screen Shot 2019-11-21 at 6 33 08 PM

I noticed the WooCommerce Stripe gateway had the same issue a while back.
woocommerce/woocommerce-gateway-stripe#148

Is there any workaround to this?

Activity

  1. ChaseWiseman commented on Nov 26, 2019

    @ChaseWiseman
    Contributor

    @sidedwards thanks for the report! We'll look at ways that can be improved for a future update.

    In the meantime, you could use the sv_wc_apple_pay_is_available filter for determining Apple Pay availability that could be used to disable it in certain circumstances, like for guest users or users with certain permissions.

    For instance, a snippet like this would do the trick:

    function sv_wc_conditional_apple_pay( $is_available ) {
    
    	if ( $is_available && ! get_current_user_id() && 'yes' !== get_option( 'woocommerce_enable_guest_checkout' ) ) {
    		$is_available = false;
    	}
    
    	return $is_available;
    }
    add_filter( 'sv_wc_apple_pay_is_available', 'sv_wc_conditional_apple_pay' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions