diff --git a/includes/gateways/class-wc-payment-gateway-cc.php b/includes/gateways/class-wc-payment-gateway-cc.php index 21fb835dd2d..c59e9ef14dc 100644 --- a/includes/gateways/class-wc-payment-gateway-cc.php +++ b/includes/gateways/class-wc-payment-gateway-cc.php @@ -32,27 +32,40 @@ class WC_Payment_Gateway_CC extends WC_Payment_Gateway { } } + /** + * Output field name HTML + * + * Gateways which support tokenization do not require names - we don't want the data to post to the server. + * + * @since 2.6.0 + * @param string $name + * @return string + */ + public function field_name( $name ) { + return $this->supports( 'tokenization' ) ? '' : ' name="' . esc_attr( $this->id . '-' . $name ) . '" '; + } + /** * Outputs fields for entering credit card information. * @since 2.6.0 */ public function form() { - $html = ''; - $fields = array(); + $html = ''; + $fields = array(); $cvc_field = '
- + field_name( 'card-cvc' ) . ' style="width:100px" />
'; $default_fields = array( 'card-number-field' => '- + field_name( 'card-number' ) . ' />
', 'card-expiry-field' => '- + field_name( 'card-expiry' ) . ' />
' );