Home › Forums › WoodMart support forum › move “Have a coupon? Click here to enter your code and form”
move “Have a coupon? Click here to enter your code and form”
- This topic has 4 replies, 2 voices, and was last updated 8 months ago by
leejay123.
-
AuthorPosts
-
August 23, 2024 at 12:42 am #591920
leejay123ParticipantHello,
I’ve created a custom checkout layout using the Woodmart theme. You can view it here: https://gyazo.com/d9c0e4c690eadcef44556fe2aaf5ab26.
However, on the custom layout page I designed, the “Have a coupon? Click here to enter your code” text still appears, along with the form that expands when clicked. You can see this issue here: https://gyazo.com/35aea5cd109c3fea849df465784ec786.
I’ve been looking through the support topics on the official Woodmart forums at https://xtemos.com/forums/forum/woodmart-premium-template, and I’ve noticed that other users with similar issues have been advised to create custom checkout or cart layouts. I followed this advice and successfully created a custom layout, but the coupon code section is still visible and is affecting the overall layout.
I would have assumed that there would be a coupon code element available in Elementor that we could use to position the coupon code wherever we want, especially since it’s a custom layout.
I decided to try using some PHP code to unhook the coupon form and move it to a different location. However, no matter what code I use, it doesn’t seem to work! My intention is not to disable the coupon form or text entirely, but rather to reposition it above or below the “Place Order” button on my custom checkout page layout.
Could you please offer guidance on how I can move the coupon form to a different position on the checkout page without disabling it? I understand that custom code may fall outside your support scope, but if that’s the case, why suggest creating a custom layout when other users have raised similar topics and encountered the same issue?
Furthermore, I tried the below snippet too:
PHP Snippet 2: Move Coupon Form @ WooCommerce Checkout Page
/** * @snippet Remove Coupon Form @ WooCommerce Checkout (Top) * @how-to Get CustomizeWoo.com FREE * @author Rodolfo Melogli * @compatible WooCommerce 6 * @community https://businessbloomer.com/club/ */ remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); /** * @snippet Display Coupon Form @ WooCommerce Checkout (Bottom) * @how-to Get CustomizeWoo.com FREE * @author Rodolfo Melogli * @compatible WooCommerce 6 * @community https://businessbloomer.com/club/ */ add_action( 'woocommerce_review_order_after_submit', 'bbloomer_checkout_coupon_below_payment_button' ); function bbloomer_checkout_coupon_below_payment_button() { echo '<hr>'; woocommerce_checkout_coupon_form(); }
This is the result: https://gyazo.com/e29c8c6bbf35bfb13d29d2fc17b89cf6
After implementing the code above, I noticed that two coupon fields are now appearing on the checkout page. This duplication is causing problems when either field is clicked, leading to unexpected behavior.
This code snippet removes the coupon form from its default position at the top of the WooCommerce checkout page and moves it to a new position below the payment button. Here’s a simple explanation of how it works:
Remove the Coupon Form from the Top of the Checkout Page:
The remove_action function is used to unhook (remove) the coupon form from its original location.
Specifically, it removes the woocommerce_checkout_coupon_form from the woocommerce_before_checkout_form hook, which is where WooCommerce normally displays the coupon form (at the top of the checkout page).Add the Coupon Form to the Bottom of the Checkout Page:
The add_action function adds a custom function (bbloomer_checkout_coupon_below_payment_button) to a different hook: woocommerce_review_order_after_submit.
This hook is located below the payment button on the checkout page.Custom Function to Display the Coupon Form:
The bbloomer_checkout_coupon_below_payment_button function is defined to insert the coupon form at the new location.
Inside this function, the coupon form is displayed using the woocommerce_checkout_coupon_form() function, and a horizontal line (<hr>) is added for visual separation.-
This topic was modified 8 months, 1 week ago by
leejay123.
August 23, 2024 at 12:21 pm #592009
Hung PhamKeymasterHello leejay123,
Thanks for reaching to us.
Sorry but it requires customizations and this is beyond our limitations and support policy.
Best Regards.
August 23, 2024 at 1:02 pm #592019
leejay123ParticipantThat does not answer my question? I stated, “Could you please offer guidance on how I can move the coupon form to a different position on the checkout page without disabling it? I understand that custom code may fall outside your support scope, but if that’s the case, why suggest creating a custom layout when other users have raised similar topics and encountered the same issue?”
Moreover, I attempted to override the default checkout/form-coupon.php in WooCommerce using a plugin (https://booster.io/docs/woocommerce-template-editor/). I made the PHP modifications, but nothing changed. I’ve come to realize that the issue lies with the Woodmart Theme, which appears to have similar template files. Could you tell me which template in Woodmart is overriding the default WooCommerce checkout/form-coupon.php?
August 25, 2024 at 4:03 am #592314
Hung PhamKeymasterHello leejay123,
First of all, I’m really sorry have taken long time to reply you due to the weekend.
Sorry for the inconveniences you are experiencing. Yes, there is no such an option to move coupon to new position. It requires customizations and this is beyond our limitations and support policy.
Best Regards.
August 26, 2024 at 2:32 pm #592610
leejay123ParticipantThank you, please close this topic
-
This topic was modified 8 months, 1 week ago by
-
AuthorPosts
The topic ‘move “Have a coupon? Click here to enter your code and form”’ is closed to new replies.
- You must be logged in to create new topics. Login / Register