Title: Back button / Return button to category
Last modified: April 15, 2020

---

# Back button / Return button to category

 *  [busybees](https://wordpress.org/support/users/mick69145/)
 * (@mick69145)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/back-button-return-button-to-category/)
 * Hi,
 * I want to add a back button to the view cart notification. I think this is better
   for UX. Please check this video to see why the current process is less user friendly:
   [https://www.loom.com/share/4a7759900a85489594933d10470e7a69](https://www.loom.com/share/4a7759900a85489594933d10470e7a69)
 * Abrasives is the parent category where there are 3 child categories. When the
   visitor ads some belts to the cart I would like a back button so it’s easy to
   go back to the child category. The button should be next to the view cart button
   notification. The text should be ‘ALL (CHILD CATEGORY)’ for example ‘ALL ABRASIVE
   BELTS’
 * I already found this topic but didn’t do exactly what I want: [https://wordpress.org/support/topic/back-button-return-button/](https://wordpress.org/support/topic/back-button-return-button/)
 * I have added this PHP snippet after product meta for testing:
 *     ```
       add_action( 'woocommerce_product_meta_end', 'my_function_sample', 10 );
       function my_function_sample() {
         global $product;
         echo ' <button type="button" onclick="history.back();"> All [previous category] </button> '; 
       }
       ```
   
 * Now the button works as a back button. So when I added the belts to cart and 
   press the button the visitor goes back to the same page before adding to cart.
 * Thanks in advance for your help!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fback-button-return-button-to-category%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Riaan K.](https://wordpress.org/support/users/riaanknoetze/)
 * (@riaanknoetze)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/back-button-return-button-to-category/#post-12678192)
 * Hi there,
 * This is a fairly complex development topic. I’m going to leave it open for a 
   bit to see if anyone is able to chime in to help you out.
 * I can also recommend the following places for more development-oriented questions:
    1. WooCommerce Slack Community: [https://woocommerce.com/community-slack/](https://woocommerce.com/community-slack/)
    2. WooCommerce FB group: [https://www.facebook.com/groups/advanced.woocommerce/](https://www.facebook.com/groups/advanced.woocommerce/)
 *  Thread Starter [busybees](https://wordpress.org/support/users/mick69145/)
 * (@mick69145)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/back-button-return-button-to-category/#post-12678299)
 * Hi Riaan,
 * After some trial and error I’ve made this code that does exactly what I want:
 *     ```
       add_action( 'woocommerce_before_add_to_cart_form', 'my_function_sample', 10 );
       function my_function_sample() {
         global $product;
         echo ' <button type="button" onclick="window.history.go(-2); return false;"> Continue shopping </button> '; 
       }
       ```
   
 * I want to display the ‘continue shopping’ button before the ‘view cart’ button
   in the notification that pops when I add something to the cart. I can’t find 
   the hooks for woocommerce message or before the ‘view cart’ button.
 * Here is a video where I explain what I want to achieve: [https://www.loom.com/share/b46ee59ffb934fbdbff53b972db8b078](https://www.loom.com/share/b46ee59ffb934fbdbff53b972db8b078)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Back button / Return button to category’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [back button](https://wordpress.org/support/topic-tag/back-button/)

 * 2 replies
 * 2 participants
 * Last reply from: [busybees](https://wordpress.org/support/users/mick69145/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/back-button-return-button-to-category/#post-12678299)
 * Status: not resolved