How to Remove American Express

My client is using Auth.net as their gateway and does not want to allow purchases from Amex. How can I hide Amex from the card_array graphic on checkout? I'd prefer to not have to modify plugin files so I wouldn't have to maintain the changes through updates.

Thanks,
Scott

  • Ash
    • WordPress Hacker

    Hello @alaragroup

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    I don't think you can do it without editing the plugin files. But, let me ask the developer @Jonathan about this for his valuable opinion on this.

    Please note that, developer response might be slower than usual staff response as he is busy with other issues too. Thanks for your patience.

    Cheers
    Ash

  • Jonathan
    • The Bug Hunter

    Hey @alaragroup,

    Try adding the following to your theme's functions.php file:

    add_action('mp_billing_process', 'my_deny_american_express');
    function my_deny_american_express() {
    	global $mp, $mp_gateway_active_plugins;
    
    	$cardnum = isset($_POST['card_num']) ? $_POST['card_num'] : '';
    
    	if ( !isset($mp_gateway_active_plugins['authorizenet-aim']) )
    		//authorize.net gateway is not enabled - don't continue
    		return;
    
    	if ( $mp_gateway_active_plugins['authorizenet-aim']->_get_card_type($cardnum) != 'American Express' )
    		//submitted card is not American Express - don't continue
    		return;
    
    	$mp->cart_checkout_error(__('We\'re sorry, but American Express is not accepted. Please enter a different card number and try again.', 'mp'), 'card_num');
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.