Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sidedwards opened this issue Nov 22, 2019 · 1 comment

Comments

@sidedwards
Copy link

sidedwards commented Nov 22, 2019

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?

@ChaseWiseman
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants