WooCommerce: Auto-expand the coupon field on your checkout page

By default, the coupon field on your WooCommerce checkout page is collapsed and hidden (and sometimes missed by the user). If like some folks, you’d like the checkout page coupon field to be expanded at all times, then the following code will do just that

add_action( 'wp_footer', 'woocommerce_show_coupon', 99 );
function woocommerce_show_coupon() {
echo '
<script type="text/javascript">
jQuery(document).ready(function($) {
$(\'.checkout_coupon\').show();
});
</script>
';
}


Was this helpful? Please buy me a coffee






This code should be added to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update.

Share your thoughts

Your email address will not be published. Required fields are marked *