autoship_force_save_card (function)

(src/checkout.php) Used to force the saving of credit card tokens targeting the payment form element Ids for supported payment gateways at checkout.

Function

/**
 * Includes the Force Save Card JS based on if the cart has Autoship Items
 */
function autoship_force_save_card() {

	if ( autoship_cart_has_valid_autoship_items() ) {

		$gateway_element_ids = apply_filters( 'autoship_checkout_supported_payment_gateway_save_method_ids', array(
			'wc-stripe-new-payment-method',
			'wc-authorize-net-cim-credit-card-tokenize-payment-method',
			'wc-braintree-credit-card-tokenize-payment-method',
			'wc-braintree-paypal-tokenize-payment-method',
			'wc-cyber-source-tokenize-payment-method',
			'wc-nmi-gateway-woocommerce-credit-card-new-payment-method',
			'wc-sagepaymentsusaapi-new-payment-method',
			'trustcommerce-save-card',
			'wc-square-credit-card-tokenize-payment-method',
			'wc-sagepaydirect-new-payment-method',
			'wc-cybersource-credit-card-tokenize-payment-method',
			'wc-wc_checkout_com_cards-new-payment-method'
		) );

		autoship_print_scripts_data( array(
			'AUTOSHIP_SAVE_PAYMENT_ELEMENT_IDS' => $gateway_element_ids
		));

		printf( "\n<script src=\"%s\"></script>\n",
			plugin_dir_url( Autoship_Plugin_File ) . 'js/force-save-cards.js'
		);

	}
}