Skip to content
Advertisement

Adding a “return to shop” button on single product pages that leads back to product parent category

My client wants to place a “return to shop” button on single product pages in WooCommerce that leads back to the previous page and not the main shop page.

I have explained that all browsers have back buttons but they are dead set on having this button. I’ve even mentioned activating breadcrumbs but they don’t like those either.

How can I achieve That. Any help is greatly appreciated.

Advertisement

Answer

You will get the category id by using bellow code and then add if condition to show the like

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement