Skip to content

Instantly share code, notes, and snippets.

@Sirvijver
Created December 5, 2022 09:29
Show Gist options
  • Select an option

  • Save Sirvijver/1f9515188b7299e9ca7f6125ffcc5429 to your computer and use it in GitHub Desktop.

Select an option

Save Sirvijver/1f9515188b7299e9ca7f6125ffcc5429 to your computer and use it in GitHub Desktop.
make PayPal Card Processing gateway default selection in the checkout
add_action( 'template_redirect', 'define_default_payment_gateway' );
function define_default_payment_gateway(){
if( is_checkout() && ! is_wc_endpoint_url() ) {
$default_payment_id = 'ppcp-credit-card-gateway';
WC()->session->set( 'chosen_payment_method', $default_payment_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment