WooCommerce Checkout – Changing Coupon Text

This topic has 12 replies, 5 voices, and was last updated 10 years, 1 months ago ago by Robert Hall

  • Avatar: khoavo
    khoavo
    Participant
    May 6, 2015 at 22:55

    Hi there, could you direct me on the path to edit the “Coupon” text in the Checkout Page?

    Right now, the default is: Have a coupon? Click here to enter your code
    Would like to edit to: Have a promo code? Click here to enter your code

    Thanks!

    Please, contact administrator
    for this information.
    11 Answers
    Avatar: Robert Hall
    Robert Hall
    Participant
    May 7, 2015 at 07:50

    Hello,

    You can change this text in \plugins\woocommerce\templates\checkout\form-coupon.php file on line 18.

    Regards,
    Robert Hall.

    Avatar: khoavo
    khoavo
    Participant
    May 7, 2015 at 08:11

    I currently have the Child Theme activated. How can I integrate this edit so future theme updates will not effect it? Thanks.

    Avatar: Robert Hall
    Robert Hall
    Participant
    May 7, 2015 at 08:24

    Hello,

    In this case you need to translate this text. Please read more here how to translate:
    http://docs.woothemes.com/document/woocommerce-localization/

    Regards,
    Robert Hall.

    Avatar: khoavo
    khoavo
    Participant
    May 7, 2015 at 10:47

    From the how to translate (localization) link you provided:

    1) The Local Translate plugin doesn’t seem to work. I tried translating the words I want, the when I try to download the PO file, I keep getting a Page Not Found (404) Error.

    2) The CodeStyling Localization link goes to a CodeStyling Localization Preserver plugin instead. I can’t use the Preserver Add-on Plugin without the CodeStyling Localization plugin and this one seems to no longer exist in the WP Plugins Directory.

    3) The PoEdit plugin is too complicated to use.

    Your thoughts? I only need to change couple words in the Checkout Page. They’re English to English edits, same language, just different wording. Thanks.

    Avatar: Brian Johnson
    Brian Johnson
    Member
    May 7, 2015 at 10:54

    Hello

    You may transfer this file to your child theme saving folders structure like Child Theme\woocommerce\templates\checkout\form-coupon.php.

    With best regards
    Brian Johnson

    Avatar: khoavo
    khoavo
    Participant
    May 7, 2015 at 11:10

    But these php files are in the “Plugins” folder, not inside “themes”. I don’t think the royal-child works since it only links to the “theme/royal”folder, right?

    These are the two paths to the two files I want to change:

    \plugins\woocommerce\templates\checkout\form-coupon.php

    AND

    \woocommerce\includes\abstracts\abstract-wc-payment-gateway.php

    Avatar: Eva
    Eva Kemp
    Participant
    May 7, 2015 at 11:19

    Hello,

    You can copy the modified file /wp-content/plugins/woocommerce/templates/checkout/form-coupon.php to the directory wp-content/themes/royal-child/woocommerce/checkout.
    Please try it.

    Regards,
    Eva Kemp.

    Avatar: khoavo
    khoavo
    Participant
    May 7, 2015 at 11:30

    Alright, so that worked for the form-coupon.php – Thanks!

    But my other php file I need to edit has the path:

    plugins\woocommerce\includes\abstracts\abstract-wc-payment-gateway.php

    What’s the path to insert this into my royal-child folder to make it work?

    Avatar: stan
    Stan Russell
    Participant
    May 7, 2015 at 12:27

    Hello,

    in this case we recommend you to contact Woocommerce support in order to receive qualified advice about editing plugin files. Please check here: https://support.woothemes.com/hc/en-us

    Regards,
    Stan Russell.

    Avatar: khoavo
    khoavo
    Participant
    May 7, 2015 at 21:44

    I added the script below to my royal-child/functions.php and it seems to work fine for simple locale translations. Thanks for the guidance!

    add_filter(‘gettext’, ‘translate_text’);
    add_filter(‘ngettext’, ‘translate_text’);

    function translate_text($translated) {
    $translated = str_ireplace(‘Expiry (MM/YY)’, ‘Expires (MM/YY)’, $translated);
    return $translated;
    }

    Avatar: Robert Hall
    Robert Hall
    Participant
    May 8, 2015 at 07:49

    Hello,

    You’re welcome!
    If you have any questions please feel free to contact us.

    Regards,
    Robert Hall.

  • Viewing 12 results - 1 through 12 (of 12 total)

The issue related to '‘WooCommerce Checkout – Changing Coupon Text’' has been successfully resolved, and the topic is now closed for further responses

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.