Jens
Jens

Reputation: 145

Change position of "Place order" button Woocommerce Checkout

I have tried to change the position of the checkout button in Woocommerce. This button is placed directly under the payment options normally.

I want to display it below Total amount under the order summary. Is there any hook to move this button? I have tried with the different templates, but all I get is a blank button.

Thanks!

Upvotes: 3

Views: 5003

Answers (1)

Andrew Schultz
Andrew Schultz

Reputation: 4243

You could use this code to output the button underneath the order details. I tried placing an order with the button moved into this position and it still works.

function output_payment_button() {
    $order_button_text = apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) );
    echo '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />';
}

add_action( 'woocommerce_review_order_before_payment', 'output_payment_button' );

function remove_woocommerce_order_button_html() {
    return '';
}

add_filter( 'woocommerce_order_button_html', 'remove_woocommerce_order_button_html' );

Upvotes: 5

Related Questions