From 264bccf505c55bd96e6b0f01bc74c4d8fb95997d Mon Sep 17 00:00:00 2001 From: James Allan Date: Wed, 17 Feb 2021 11:42:30 +1000 Subject: [PATCH] Prevent displaying coupon form on checkout requiring login --- includes/wc-template-functions.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 9f37d99641e..4bdb5c16483 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -2292,12 +2292,14 @@ if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) { * Output the Coupon form for the checkout. */ function woocommerce_checkout_coupon_form() { - wc_get_template( - 'checkout/form-coupon.php', - array( - 'checkout' => WC()->checkout(), - ) - ); + if ( is_user_logged_in() || WC()->checkout()->is_registration_enabled() || ! WC()->checkout()->is_registration_required() ) { + wc_get_template( + 'checkout/form-coupon.php', + array( + 'checkout' => WC()->checkout(), + ) + ); + } } }