Making product url structured and hieracrial is very easy, this process is very simillar to adding categories and subcategories to WordPress posts.
Go to Settings–>Permalink and add “/%product_cat%/” (without double inverted commas)
Please make sure you go through above mentioned article to know about category structure. Same needs to be followed for product categories as well.