When it comes to the shell life of a product, generally, it can last up to 3 years if it is unopened. If you have old hair product that's been sitting in your cabinet (for who knows how many year), I think it's time to discard them. When a product expires the active ingredient is no longer working, so they no longer do what they're marketed to do.
One way to tell when your hair product expire is look at the label in the back.
Specifically, the trash can icon.
Now, the number isn't always beside the trash can. It can be labeled inside the trash can icon. Just for your information, the icon under the trash can is the recycle sign. So, please do the earth a favor and recycle after you're done with the product.
The example above says 24M. It stands for 24 months. Which means you can keep it for two years after it is opened.
Here is an example of Lush's product. Most of their products are handmade by their staff somewhere. Lush makes it clear to the customer by listing the staff that made the product, when it is made and how long it will last. I own several Lush products and I can say it is safe to use it 1-2 weeks after the expiration date list.
That's it. I hope you learned something today!