Which file do I need to edit if I don’t want user to click the link to apply the coupon code?
In simple, I want no LINK to be clicked on.
I want the apply coupon appear below the text "Have a coupon?" so that user can ALWAYS see the section.
Updated
This can be done very easily using dedicated woocommerce_checkout_coupon_message
filter hook:
add_filter( 'woocommerce_checkout_coupon_message', 'custom_checkout_coupon_message', 20, 1 );
function custom_checkout_coupon_message( $message ) {
?>
<script type='text/javascript'>
jQuery(document).ready( function($){
setTimeout(function(){
$('form.checkout_coupon').css('display','block');
}, 300);
});
</script>
<?php
// HERE your custom message
return __( 'Have a coupon?', 'woocommerce' ) . ' <a class="showcoupon-off">' . __( 'Below you can enter your coupon code', 'woocommerce' ) . '</a>';
}
Code goes in function.php file of the active child theme (or active theme). Tested and works.
来源:https://stackoverflow.com/questions/49272869/unlink-coupon-form-on-woocommerce-checkout-page