2

How can I dynamically change the url of a product?

Now I got this url

www.domain.com/product-name.html

I need to add SKU, to my url like this:

www.domain.com/product-name-SKU.html

1 Answer 1

0

In Magento 2 you can extend

Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator

class file. Append product SKU into

prepareProductUrlKey(), prepareProductDefaultUrlKey(),getUrlPath() function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.