Last active
February 27, 2019 00:29
-
-
Save NickGreen/90c733c1fcebd612d7961a3bc79ef16f to your computer and use it in GitHub Desktop.
Set Auth.net to 'Authorize only' if there are no subscription products in the cart
This file contains hidden or 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
<?php | |
// note: this would require the store settings to be set to "capture" to begin with | |
function wc_authorize_net_cim_credit_card_change_transaction_type_no_subs( $settings ) { | |
if ( method_exists( 'WC_Subscriptions_Cart' , 'cart_contains_subscription' ) ) { | |
if ( ! WC_Subscriptions_Cart::cart_contains_subscription() ) { | |
$settings['transaction_type'] = 'authorization'; | |
} | |
} | |
return $settings; | |
} | |
add_filter( 'option_woocommerce_authorize_net_cim_credit_card_settings', 'wc_authorize_net_cim_credit_card_change_transaction_type_no_subs' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment