• Resolved magapascansky

    (@magapascansky)


    Hello! I am developing a custom woocommerce theme and I made my own form-checkout.php. Everything is going well but I’m having a problem with the coupons.

    I understand that “do_action( ‘woocommerce_before_checkout_form’, $checkout );” calls the coupon form. The problem is that it puts de form on top of my page, and I want it right before the order review.

    I tried calling it with “woocommerce_checkout_coupon_form();” and hiding the other line but it works differently: when I click on “apply” it makes the purchase.

    Can you please help me?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • SilkyPress

    (@diana_burduja)

    Hello @magapascansky,

    The checkout form is one <form> HTML element and the coupon form is another <form> HTML element. Normally these two <form> elements are next to each other.

    Trying to place the coupon form before the order review will nest the two <form> elements, which, according to MDN Web Docs: Warning: It's strictly forbidden to nest a form inside another form. Nesting can cause forms to behave unpredictably, so it is a bad idea.

    Nevertheless, there are workarounds to placing the coupon form inside the checkout. See this article on Cloudways or the answer on this Stack Overflow question.

    anastas10s

    (@anastas10s)

    ?? hey @magapascansky

    Just to add, linked here is the related documentation on WooCommerce template structure, for your convenience.

    Moreover, for a visual hook guide of the WooCommerce Checkout page, I’d recommend taking a look at this page.

    I hope this helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Checkout coupon form’ is closed to new replies.