WooCommerce - excelling eCommerce
Back button from single product page (1 post)

  1. shainanz
    Posted 2 years ago #

    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.)



Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic