Adding Category Slug to the URL has some benefits like:
1- It Increases Click through Rate from the Search Results.
2- Customers have better understanding, where they will be landing too. Also, Make sure that slug category is descriptive or small.
In this tutorial, We will learn how to add category slug to the URL of product. The default URL structure don’t contain the category slug in it. The default url structure is in this format: ROOT_URL/product/product-name
So We want to add category slug in the url. To do this go to admin panel of your site and click on permalinks under settings. From here select “shop base with category” option under product permalink base section.
Click on save changes button to apply changes. Now go to product page again and you’ll see category being added to product urls.