Support » Plugin: WooCommerce » Back button from single product page

  • Hi!
    I’m trying to get a back button working from the single product page to its parent category. Right now I’m using JavaScript:
    <a href="javascript:history.go(-1)">&larr; Back</a>

    It works most of the time, but it leaves some room for error. For example, if someone gets the link directly to the product after a Google search, they’d be sent back to Google, not to the parent category. Is there a better way to do this using get_categories or similar? (I’m not very knowledgeable of PHP, so I may be totally off base here.)


  • The topic ‘Back button from single product page’ is closed to new replies.