This topic has 12 replies, 3 voices, and was last updated 10 years, 6 months ago ago by Eva Kemp
I am trying to change the css in the ID store for the apply coupon area/text in the checkout and cart. I know that this is woo commerce, but I am following your directions on where to modify the code and it is not working – please advise.
Here is the code….
<?php
// rename the coupon field on the cart page
function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) {
// bail if not modifying frontend woocommerce text
if ( is_admin() || ‘woocommerce’ !== $text_domain ) {
return $translated_text;
}
if ( ‘Apply Coupon’ === $text ) {
$translated_text = ‘Apply Promo Code’;
}
return $translated_text;
}
add_filter( ‘gettext’, ‘woocommerce_rename_coupon_field_on_cart’, 10, 3 );
<?php
// rename the “Have a Coupon?” message on the checkout page
function woocommerce_rename_coupon_message_on_checkout() {
return ‘Have a Promo Code?’;
}
add_filter( ‘woocommerce_checkout_coupon_message’, ‘woocommerce_rename_coupon_message_on_checkout’ );
// rename the coupon field on the checkout page
function woocommerce_rename_coupon_field_on_checkout( $translated_text, $text, $text_domain ) {
// bail if not modifying frontend woocommerce text
if ( is_admin() || ‘woocommerce’ !== $text_domain ) {
return $translated_text;
}
if ( ‘Coupon code’ === $text ) {
$translated_text = ‘Promo Code’;
} elseif ( ‘Apply Coupon’ === $text ) {
$translated_text = ‘Apply Promo Code’;
}
return $translated_text;
}
add_filter( ‘gettext’, ‘woocommerce_rename_coupon_field_on_checkout’, 10, 3 );
Hello,
Please clarify us what exactly you would like to change in “Apply Coupon” button.
If you want to change color of the text inside the button add the following code into your custom.css:
.form-row .button {
color: #CF1D1D !important;
}
Here is the tutorial how to create custom.css: https://www.youtube.com/watch?v=Qok2zRedRMY&list=PLMqMSqDgPNmD4uhGI1IBhr1iaEy81TMff&feature=share&index=1.
Regards,
Jack Richardson
Thanks for the reply – I am actually wanting to change the verbiage from coupon to promo on all areas in cart and checkout.
Hello,
To change the text “Apply coupon” on the Cart page you need edit the file cart.php in /wp-content/themes/idstore/woocommerce/cart, find the code
<label for="coupon_code"><?php _e('Coupon', ETHEME_DOMAIN); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button apply-coupon" name="apply_coupon" value="<?php _e('Apply Coupon', ETHEME_DOMAIN); ?>" />
(line 117) and change “Apply Coupon” text in ('Apply Coupon', ETHEME_DOMAIN)
Regards,
Eva Kemp.
Thanks for the info – worked perfectly – now what about the checkout page – I can;t seem to find “Have a Coupon?
Regarding the Checkout page, you need edit the file form-coupon.php in the directory /wp-content/plugins/woocommerce/templates/checkout/.
Regards,
Eva Kemp.
Thanks for the reply – unfortunately the code is not there for modifying “Have a coupon?
I’ve checked the file and it’s placed there. Are you checking the correct file? It’s form-coupon.php in the directory wp-content/plugins/woocommerce/templates/checkout.
“Have a coupon?” text is in line 18.
Regards,
Eva Kemp.
Thank you got it. I tested the pages all looks good, but 1) when a code is applied in check out it still says coupon code as a line item in cart, 2) also when I add the code – it says coupon code successfully added.
Where do I edit this as well.
You need edit the file class-wc-coupon.php (line 578) in /wp-content/plugins/woocommerce/includes/ directory.
Regards,
Eva Kemp.
Thanks for the reply, but the “Coupon has just been applied” and the “Coupon” shown in the cart are not there to be edited.
Could you please provide us with the coupon code to check it from our side?
Regards,
Eva Kemp.
The issue related to '‘Modifying css code’' has been successfully resolved, and the topic is now closed for further responses