Hooks with WooCommerce do not work on finalizing purchase

Posted in: Newspaper
Post count: 1

Hello, I have installed the WooCommerce plugin in the Newspaper theme and I want to customize the thank you page by adding a summary of the order that does not show by default, when using the payment method of bank check, but there is no way to make the hooks work, the 2 redirect me to the cart page with a message from your cart is empty. (the order is successful).

I have tried a specific hook for the payment gateway with id ‘cheque’:


function woocommerce_thankyou_cheque_payment ($ order_id) {
    echo '<p> Thank you for your purchase. Payment will be made in cash at the establishment </ p> ';
    return '<h1> THANK YOU. </ h1>';
}
add_action('woocommerce_thankyou_cheque', 'woocommerce_thankyou_cheque_payment', 10, 1);

And this hook is general, to check if something worked:


function redirigir_paginaGracias_metodoPago ($ order_id) {
    $ order = new WC_Order ($ order_id);
    $ url = get_home_url (null, 'thanks-pagometalico');
    // if ($ order-> status! = 'failed') {wp_redirect ($ url); exit; }
}
add_action('woocommerce_thankyou', 'redirect_paginaGracias_metodoPago', 10, 1);

Maybe I have to see something with the filters? How can i fix this?

Thank you!

Post count: 20688

Hi,

You could edit the Woocommerce thank you template page itself, and enter your content there for example
https://www.screencast.com/t/81wVKG4MS
Or maybe try something like this and create your own custom thank you page
https://www.woobeginner.com/woocommerce-thank-you-page/
https://www.tychesoftwares.com/how-to-customize-the-woocommerce-thank-you-page/

Thanks

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.