Modifying css code - by brazuka - on WordPress WooCommerce support

This topic has 12 replies, 3 voices, and was last updated 9 years, 10 months ago ago by Eva Kemp

  • Avatar: brazuka
    brazuka
    Participant
    May 27, 2014 at 21:54

    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 );

    Please, contact administrator
    for this information.
    11 Answers
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    May 28, 2014 at 07:25

    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

    Avatar: brazuka
    brazuka
    Participant
    May 28, 2014 at 13:58

    Thanks for the reply – I am actually wanting to change the verbiage from coupon to promo on all areas in cart and checkout.

    Please, contact administrator
    for this information.
    Avatar: Eva
    Eva Kemp
    Support staff
    May 28, 2014 at 15:06

    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.

    Avatar: brazuka
    brazuka
    Participant
    May 28, 2014 at 16:34

    Thanks for the info – worked perfectly – now what about the checkout page – I can;t seem to find “Have a Coupon?

    Avatar: Eva
    Eva Kemp
    Support staff
    May 28, 2014 at 16:41

    Regarding the Checkout page, you need edit the file form-coupon.php in the directory /wp-content/plugins/woocommerce/templates/checkout/.

    Regards,
    Eva Kemp.

    Avatar: brazuka
    brazuka
    Participant
    May 28, 2014 at 16:55

    Thanks for the reply – unfortunately the code is not there for modifying “Have a coupon?

    Avatar: Eva
    Eva Kemp
    Support staff
    May 28, 2014 at 17:02

    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.

    Avatar: brazuka
    brazuka
    Participant
    May 28, 2014 at 17:20

    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.

    Avatar: Eva
    Eva Kemp
    Support staff
    May 28, 2014 at 18:03

    You need edit the file class-wc-coupon.php (line 578) in /wp-content/plugins/woocommerce/includes/ directory.

    Regards,
    Eva Kemp.

    Avatar: brazuka
    brazuka
    Participant
    May 28, 2014 at 18:09

    Thanks for the reply, but the “Coupon has just been applied” and the “Coupon” shown in the cart are not there to be edited.

    Avatar: Eva
    Eva Kemp
    Support staff
    May 28, 2014 at 18:17

    Could you please provide us with the coupon code to check it from our side?

    Regards,
    Eva Kemp.

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

The issue related to '‘Modifying css code’' has been successfully resolved, and the topic is now closed for further responses

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