Amending the Position of the Google Pay and Apple Pay Buttons in WooCommerce
How to move the Google Pay and Apple Pay buttons in your WooCommerce store.
How to move the Google Pay and Apple Pay buttons in your WooCommerce store.
This article is for me really, as a reminder of how to do this job when the plugin updates and wipes out my changes :-D
To change the default position of the Google Pay and Apple Pay buttons on your WooCommerce site, you need to modify the code in the plugin that generates it. I am using Square, so will amend the Square plugin.
I navigated to the Gateway folder, and found the Digital_Wallet.php file. On lines 83-93 are the lines to add the buttons to the WordPress hooks. I amended the final one from
add_action( 'woocommerce_before_checkout_form', array( $this, 'render_button' ), 15 );
to
add_action( 'woocommerce_review_order_before_payment', array( $this, 'render_button' ), 15 );
I also amended a small amount of CSS to make it look a bit better, and make the 'OR' part stand out a bit more as it was causing confusion.
I hope this helps somebody in future!
We help companies and individuals build out their brand guidelines.