- This topic has 7 replies, 2 voices, and was last updated 4 years, 2 months ago by David.
-
AuthorPosts
-
February 20, 2020 at 8:05 pm #1172148Anthony
I’m trying to move the coupon code input to display down by the payment methods.
This is what I’m trying to do here:
https://drive.google.com/file/d/1Tnl-XrLi57gNGscPLKBiKm7OnFt5UC8i/view?usp=sharing
I want to disable the dropdown and move A in the screenshot, to where B is in the screenshot.
At the very least I would love to disable the dropdown and just have the input present.
Thanks
February 21, 2020 at 4:12 am #1172408DavidStaffCustomer SupportHi there,
try adding this to your sites functions:
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); add_action( 'woocommerce_review_order_before_payment', 'woocommerce_checkout_coupon_form', 5 );
https://docs.generatepress.com/article/adding-php/
And this CSS to remove the now redundant toggle:
.woocommerce-form-coupon-toggle { display: none; }
February 21, 2020 at 5:49 am #1172499AnthonyPerfect! Thanks David!
February 21, 2020 at 5:53 am #1172504DavidStaffCustomer SupportGlad to be of help
February 21, 2020 at 6:16 am #1172514AnthonyI’m trying to remove the billing details and just have the checkout portion on the right-hand side.
But now when I enter the coupon code in the area you helped me move it to, it just kick starts the Paypal Processor.
Here’s the code I’m using:
CSS that hides the headers customer details:
.woocommerce-products-header,
#customer_details,
#order_review_heading
{
display: none;
}#customer_details+#wc_checkout_add_ons,
#order_review, #order_review_heading
{
margin: 0 auto!important;
float:none;
width: 80%
}PHP that hides the checkout fields and moves/removes dropdown of the coupon box:
// Moving Enter Coupon Box —————————————————
remove_action( ‘woocommerce_before_checkout_form’, ‘woocommerce_checkout_coupon_form’, 10 );
add_action( ‘woocommerce_review_order_before_payment’, ‘woocommerce_checkout_coupon_form’, 5 );// Remove Billing Info Checkout Page —————————————————
add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );
function custom_override_checkout_fields( $fields ) {
unset($fields[‘billing’][‘billing_first_name’]);
unset($fields[‘billing’][‘billing_last_name’]);
unset($fields[‘billing’][‘billing_company’]);
unset($fields[‘billing’][‘billing_address_1’]);
unset($fields[‘billing’][‘billing_address_2’]);
unset($fields[‘billing’][‘billing_city’]);
unset($fields[‘billing’][‘billing_postcode’]);
unset($fields[‘billing’][‘billing_country’]);
unset($fields[‘billing’][‘billing_state’]);
unset($fields[‘billing’][‘billing_phone’]);
unset($fields[‘order’][‘order_comments’]);
unset($fields[‘billing’][‘billing_address_2’]);
unset($fields[‘billing’][‘billing_postcode’]);
unset($fields[‘billing’][‘billing_company’]);
unset($fields[‘billing’][‘billing_email’]);
unset($fields[‘billing’][‘billing_city’]);
return $fields;
}Do I need the checkout fields in order for the coupon box to work?
I had the idea to remove the billing details after I first got in touch with you so now if it helps the coupon area can be above everything on the right column.
Thanks
February 21, 2020 at 6:37 am #1172521DavidStaffCustomer SupportActually – it looks like moving the field within the ‘payment form’ is the issue – as you now have a form within a form and the coupon field submit triggers the payment ….
So re-hooking the coupon field is not a valid option unfortunately.
February 21, 2020 at 7:50 am #1172739AnthonyOk thank you! I found a work around for what I’m doing.
February 21, 2020 at 8:02 am #1172749DavidStaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.