autoship_after_save_standard_payment_method_notice (function)

(src/payments.php) Fires additional actions after a payment method is saved (Standard Gateways Only). Takes a $token_id as a parameter. 

Function:

 
/**
 * Standard Gateways Only: Fires additional autoship actions after a payment method is saved updated.
 * @param int $token_id. A WC_Payment_Token_CC token id.
 */
function autoship_after_save_standard_payment_method_notice( $token_id ){

  $hide = apply_filters('autoship_display_save_payment_method_at_checkout', is_checkout() );

  if ( $hide )
  return;

  // Get the token
  $token = WC_Payment_Tokens::get( $token_id );

  // Allow users to override the gateway id.
  $gateway_id = apply_filters('autoship_add_tokenized_payment_method_gateway_id', $token->get_gateway_id(), $token_id, $token );
  $valid_gateways = autoship_get_valid_payment_methods();

  // Only include the notice for valid gateways.
  if ( !array_key_exists( $gateway_id, $valid_gateways ) )
  return;

  // Only include notice if from Payment Method form.
  if ( isset( $_POST['payment_method'] ) )
  autoship_after_save_payment_method_autoship_action_notice( $token->get_id(), 'standard', $token->get_display_name());

}

Still need help? Contact Us Contact Us