WC_Payment_Gateway::save_payment_method_checkbox()publicWC 2.6.0

Outputs a checkbox for saving a new payment method to the database.

Method of the class: WC_Payment_Gateway{}

Return

null. Nothing (null).

Usage

$WC_Payment_Gateway = new WC_Payment_Gateway();
$WC_Payment_Gateway->save_payment_method_checkbox();

Changelog

Since 2.6.0 Introduced.

WC_Payment_Gateway::save_payment_method_checkbox() code WC 9.3.1

public function save_payment_method_checkbox() {
	$html = sprintf(
		'<p class="form-row woocommerce-SavedPaymentMethods-saveNew">
			<input id="wc-%1$s-new-payment-method" name="wc-%1$s-new-payment-method" type="checkbox" value="true" style="width:auto;" />
			<label for="wc-%1$s-new-payment-method" style="display:inline;">%2$s</label>
		</p>',
		esc_attr( $this->id ),
		esc_html__( 'Save to account', 'woocommerce' )
	);
	/**
	 * Filter the saved payment method checkbox HTML
	 *
	 * @since 2.6.0
	 * @param string $html Checkbox HTML.
	 * @param WC_Payment_Gateway $this Payment gateway instance.
	 * @return string
	 */
	echo apply_filters( 'woocommerce_payment_gateway_save_new_payment_method_option_html', $html, $this ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}