V
V
Veteran Pupkov2021-05-23 17:37:37
WordPress
Veteran Pupkov, 2021-05-23 17:37:37

How to change the coupon field in WordPress?

How to change the coupon output field in wordpress, woocommerce? I just need to change the text inside the 'apply' button, and where does it all lie xs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Dimakov, 2021-05-24
@jongallany

First of all, find this div with class "coupon"

<div class="coupon">
  <label for="coupon_code"><?php esc_html_e( 'Coupon:', 'woocommerce' ); ?></label> 
<input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <button type="submit" class="button" name="apply_coupon" style="margin-top: 0; margin-left: 50px;" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?></button>
  <?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>

Now we need to find the button and change the text and change the content inside <?php esc_attr_e?>:
<button type="submit" class="button" name="apply_coupon" style="margin-top: 0; margin-left: 50px;" value="<?php esc_attr_e( 'Your Text', 'woocommerce' ); ?>"><?php esc_attr_e( 'Your Text', 'woocommerce' ); ?></button>

Instead of Apply Coupon, you now have Your Text . Your
output will look like this:
<button type="submit" class="button" name="apply_coupon" style="margin-top: 0; margin-left: 50px;" value="Your Text">Your Text</button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question