Ask Your Question
0

Is it possible to relocate the coupon form to a section before the payment area on the WooCommerce checkout page?

asked 2022-06-22 11:00:00 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-02-26 05:00:00 +0000

qstack gravatar image

Yes, it is possible to relocate the coupon form on the WooCommerce checkout page by using hooks or filters. You can add the following code snippet to your functions.php file to move the coupon form to a section before the payment area:

add_action('woocommerce_before_checkout_form', 'move_coupon_form');

function move_coupon_form() {
    remove_action('woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10);
    add_action('woocommerce_checkout_before_customer_details', 'woocommerce_checkout_coupon_form', 10);
}

This code will remove the coupon form from its default location and add it before the customer details section. You can customize the location by changing the target hook for the add_action function.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-22 11:00:00 +0000

Seen: 7 times

Last updated: Feb 26 '22