Log which product attributes are used (ie: read from DB)?

by James Ludlow   Last Updated June 25, 2018 11:09 AM

I've taken over a Magento 2 site that is a bit of a mess. There's been an import routine running that has been creating thousands of product attributes.

None of them seem to be used on the product pages, some of the are used in a couple of custom modules. I can't be sure which are being used somewhere and which aren't.

Is there a way to know exactly which attributes are being used, whether that be output on frontend to the customer, or utilised in some module somewhere?

I've thought of a couple of options:

  1. Add an event to the Product/Attribute/Repository get method that I can then log.

  2. Maybe place some logging on the eav_attribute database table?

If anyone has had to do something similar in the past or has some feedback on what the best option would be it would be much appreciated!

Related Questions

Logging to a custom file in Magento 2

Updated April 05, 2017 09:09 AM

Magento 2 writing messages to a log file

Updated July 20, 2016 08:03 AM