Docs

Edit/Translate “Have a coupon? Click here to enter your code” on Checkout Page

Updated on

In this documentation, we will share how you can edit/translate the “Have a coupon? Click here to enter your code” text on the checkout page.

Remember, this is only applicable when the coupon field is collapsible. 

For this, you need to use a custom code.

Guide: To learn how to add a custom code, check our documentation. 

Edit The Coupon Section Text

In the code, replace the text “’Have a coupon? Some products are excluded from Saints & Sinners offers and discount codes’, ‘woocommerce’” with your desired one. 

Here is the code:

/* Change Coupon Text on the FunnelKit checkout page */

class WFACP_Change_Coupon_text {

	public function __construct() {

		add_action( 'wfacp_after_checkout_page_found', [ $this, 'action' ] );

	}

	public function action() {
		add_filter( 'woocommerce_checkout_coupon_message', function ( $html ) {

			$class = 'wfacp_showcoupon';
			if ( false !== strpos( $html, 'wfacp_main_showcoupon' ) ) {
				$class = 'wfacp_main_showcoupon';
			}

// change the text here 
			$html = ' <span  class="' . $class . '">' . __( '¿Tienes un cupón? Algunos productos están excluidos de las ofertas y códigos de descuento de Saints & Sinners') . '</span>';

			return $html;
		} );
	}


}

new WFACP_Change_Coupon_text();

Here is the output: 

WooCommerce checkout with the default coupon text before editing

Translate The Coupon Section Text

To change the language, you just need to add the translated text as shown below: 

Here we are using the same text in Spanish.

Custom code adding a translation for the checkout coupon text

Here is the output:

WooCommerce checkout showing the translated coupon text