mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-02 12:02:25 +08:00
https://github.com/strangerstudios/pmpro-snippets-library/blob/dev/checkout/select-offline-payment-type-check-gateway.php
14 lines
399 B
Text
14 lines
399 B
Text
function my_pmpro_add_payment_type_to_order( $order ) {
|
|
|
|
// Bail if payment gateway isn't check.
|
|
if ( 'check' != $order->gateway ) {
|
|
return;
|
|
}
|
|
|
|
if ( isset( $_REQUEST['payment_type']) && 'other' !== $_REQUEST['payment_type'] ) {
|
|
$order->payment_type = esc_attr( $_REQUEST['payment_type'] );
|
|
}
|
|
|
|
$order->saveOrder();
|
|
}
|
|
add_action( 'pmpro_added_order', 'my_pmpro_add_payment_type_to_order' );
|