Hi @cullachie,
Greetings from WebToffee support.
The payment method in the top of the list is given the priority and it will be preselected for new users. However, for existing users their last used payment method will be selected by default.
As this is the functionality provided by WooCommerce, we don’t have any control over it.
In any case, while searching for a solution online, we came across a thread on stackoverflow.com. We have replaced the correct payment ID for the Stripe payment method and attached the code snippet below.
add_action( 'template_redirect', 'define_default_payment_gateway' );
function define_default_payment_gateway(){
if( is_checkout() && ! is_wc_endpoint_url() ) {
// HERE define the default payment gateway ID
$default_payment_id = 'eh_stripe_pay';
WC()->session->set( 'chosen_payment_method', $default_payment_id );
}
}
Please copy the code snippet from below and paste it into your active theme’s function.php file (WordPress Dashboard > Appearance > Theme Editor > functions.php) or you can use the Code Snippet plugin to do that for you.
Kindly check using the code snippet and let us know how it goes.
Great support, many thanks. Will give it a spin today and let you know.
Marvellous, that worked exactly as i wanted.
Many thanks for super support!
Hi @cullachie,
We are glad to hear that.
If you like the plugin and support, please leave us a review here.
Your feedbacks are very important to us and it would really help us stand out in the WordPress community!