I’m making a theme and trying to test the “Add Payment Method” page (template: myaccount/form-add-payment-method.php) in the new Dashboard of WooCommerce 2.6.0. However I don’t have any payment methods to add, so I can’t see the form.
Here’s the code that checks for payment methods to display in there:
/**
* Get available gateways.
*
* @return array
*/
public function get_available_payment_gateways() {
$_available_gateways = array();
foreach ( $this->payment_gateways as $gateway ) {
if ( $gateway->is_available() ) {
if ( ! is_add_payment_method_page() ) {
$_available_gateways[ $gateway->id ] = $gateway;
} else if( $gateway->supports( 'add_payment_method' ) ) {
$_available_gateways[ $gateway->id ] = $gateway;
} else if ( $gateway->supports( 'tokenization' ) ) {
$_available_gateways[ $gateway->id ] = $gateway;
}
}
}
return apply_filters( 'woocommerce_available_payment_gateways', $_available_gateways );
}
So the gateway needs to support ‘add_payment_method’ or ‘tokenization’ to be able to be added via the “Add Payment Method” page.
Does anyone know any payment gateways I can install to test it with?