My nerves are on edge >.< Hi guys! Could you please help me with WooCommerce problem?

How do I get the information which product category I came from?
When products have multiple categories, they dont have URL/ID for every category, but only one URL/ID, so when I want to display the product category which they really came from… I cant.

When they are selecting categories one by one, category page 1, then 2, then 3 (parent, subcategory, child) … that selection stays in url … but after clicking on product in changes to or

My idea is – get that selection and somehow use to it to display category which they really came from (display it on product page or in cart after adding it to cart).

Please, do you have any idea how to do it? If so, tell me please. <3

(I am creating an e-shop which sells carpets for cars. Many companies with many type of cars with many years when those types were made…)

Read more here: PHP sessions, PHP url? How to display product category which I came from?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: