Created
August 3, 2018 03:19
-
-
Save PiotrKrzyzek/675194daf4c74b6f08e0f23caa51b1be to your computer and use it in GitHub Desktop.
WooCommerce: Select default payment gateway option on checkout page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Select Stripe as default payment gateway | |
*/ | |
add_action( 'woocommerce_before_checkout_form', 'set_default_gateway' ); | |
function set_default_gateway(){ | |
// HERE define the default payment gateway ID | |
$default_payment_gateway_id = 'stripe'; | |
WC()->session->set('chosen_payment_method', $default_payment_gateway_id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment