I am adding another type of related products. I am adding a new method to Magento\Catalog\Model\Product\Link class by way of di.xml preference. The method also does appear in the interceptor class.

However, when I follow the execution, this call is made: $this->_linkInstance = $productLink;

Where $productLink is returning type Magento\Catalog\Model\Product\Link\Proxy

When I look in this class at run time there is no reference to my method like there is for other relations:

public function useRelatedLinks() { return $this->_getSubject()->useRelatedLinks(); }

1 Answer 1


I fixed my issue above by extending the proxy class itself by including the following:

In di.xml add this preference:

<preference for="Magento\Catalog\Model\Product\Link\Proxy" type="SprintIntercom\RelatedDownloads\Model\Catalog\Product\Link\Proxy"/>

Then created a class in my custom module at Vendor\Module\Model\Catalog\Product\Link\Proxy.php

class Proxy extends \Magento\Catalog\Model\Product\Link\Proxy

And included the method:

 * {@inheritdoc}
public function useCustomLinks()
    return $this->_getSubject()->useCustomLinks();

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.