To enable category slug in product URLs go to Product Settings and find the “Insert Category in Product URLs” checkbox. It is located in Categories Settings section.
Product URLs when the setting is enabled
After the setting is enabled the permalinks will be automatically rewritten with a new scheme. All the products will have a URL as in the example: example-website.com/products/product-category/product-name
Products Without Category
When a certain product is not assigned to any category the parent will be “general”.