• 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

    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://www.ads-software.com/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 to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    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/
    2. WooCommerce FB group: https://www.facebook.com/groups/advanced.woocommerce/
    Thread Starter busybees

    (@mick69145)

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Back button / Return button to category’ is closed to new replies.