Last active
October 19, 2017 12:09
-
-
Save NiklasHogefjord/fb827bf838dd5444c309 to your computer and use it in GitHub Desktop.
Filter the payTypeIdentifier sent to Specter
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
/** | |
* Specter for WooCommerce | |
* Filter the payTypeIdentifier sent to Specter | |
* | |
**/ | |
add_filter('wc_specter_pay_type_identifier', 'my_wc_specter_pay_type_identifier', 10, 2); | |
function my_wc_specter_pay_type_identifier( $paytype, $order_id ) { | |
// Switches the paytype to D (cash payment) for all orders that uses Cach on Delivery (originally paytype P in the extension) as the payment method. | |
// See available paytypes here: http://docs.krokedil.com/se/documentation/specter-woocommerce/#10 | |
if( 'P' == $paytype ) { | |
return 'D'; | |
} else { | |
return $paytype; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do change the paytype for a specific payment method you could do something like this: