Unlink coupon form on Woocommerce checkout page

早过忘川 提交于 2019-12-02 01:11:30

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!