Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filter the payTypeIdentifier sent to Specter
/**
* 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;
}
}
@NiklasHogefjord

This comment has been minimized.

Copy link
Owner Author

commented Oct 19, 2017

Do change the paytype for a specific payment method you could do something like this:

function my_wc_specter_pay_type_identifier( $paytype, $order_id ) {
$order = wc_get_order( $order_id );
	if ( 'payson' === $order->get_payment_method() ) {
		$paytype = 'PCO';
	}
	return $paytype;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.