WooCommerce: Order Again Button @ My Account > Orders
The WooCommerce “Order Again” button displays for ‘completed’ orders on the Thank You page and View Order page. That’s a pity, because it would be useful to show it on the My Account > Orders page as well, as a custom “action”, same as the “View”, “Pay” (if pending), “Cancel” (if subscription), “Edit” (custom snippet), “Confirm” (custom snippet) buttons.
The good news is that we can code it ourselves! And just reuse most of the code we already wrote, as well as rely on the WooCommerce “listener” for the existing “Order Again” button. Enjoy!
PHP Snippet: Add “Order Again” Button to My Account > Orders Action (Completed Orders Only)
If you’re wondering how I came up with the ‘url’ code in the snippet below, I simply reused the exact same code of the woocommerce_order_again_button() function.
Also, somewhere in the Cart class, there is a “listener” that triggers when the button is clicked – see get_cart_from_session() – so because I’m using the exact same button URL, the listener triggers from the new button position as well.
This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101
WooCommerce: Custom Add to Cart URLs – The Ultimate Guide In WooCommerce you can add a product to the cart via a custom link. You just need to use the “add-to-cart” URL parameter followed by the product ID. This tutorial will show you how to create custom URLs to add simple, variable and grouped products to the cart – as well as defining the add […]
WooCommerce: Hide Price & Add to Cart for Logged Out Users You may want to force users to login in order to see prices and add products to cart. That means you must hide add to cart buttons and prices on the Shop and Single Product pages when a user is logged out. All you need is pasting the following code in your functions.php (please note: […]
WooCommerce: Add New Tab @ My Account Page One of the features of Bloomer Armada is the provision of Premium WooCommerce Q&A Support to supporters who enroll. So, how to add an extra “tab” to the My Account page, and how to add content inside it? Here’s the code I used (thanks to Mike Jolley for inspiration) – feel free to leave a […]
WooCommerce: Separate Login, Registration, My Account Pages There are times when you need to send logged out customers to a Login page and unregistered customers to a standalone Register page. As you know, the WooCommerce My Account page, which contains the Login Username or email address * Password * Remember me Log in Lost your password? shortcode, has both Login and Registration forms when […]
WooCommerce: How To Make A Website GDPR Compliant? (12 Steps) Ok, we all know that the EU General Data Protection Regulation (GDPR) will come into force on the 25th May 2018. So the main question is: what changes do we need to make on our WooCommerce website to become compliant? And another important query might be: how does GDPR affect non-European WooCommerce websites? In this […]
Business Bloomer Founder
Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli