0

I need to get Canonical Product Url inside app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/list.phtml.

I tried to use:

$block->getProductUrl($_product)

and:

$_product->getUrl()

but I receive the product url with all the categories while the canonical url has no category. I'm using the Mageworx SEO extension if this can help.

1 Answer 1

0

You can achieve it by using:

$_product->getUrlModel()->getUrl($_product, ['_ignore_category' => true])

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.