Reduce log noise from deleted products in Last Ordered Items in Adobe Commerce

You notice recurring CRITICAL errors in the exception.log when a customer logs in and the system attempts to load product data for items that have been deleted. Although this behavior is expected, it can create unnecessary log noise in production environments. A configurable option now allows merchants to suppress these errors when deleted products appear in the Last Ordered Items customer data section.

Description description

Environment

Adobe Commerce (all deployment methods) 2.4.9-beta1 and later

Issue/Symptoms

Each time a customer logs in, the Last Ordered Items section attempts to load product information for deleted products. This triggers a NoSuchEntityException and logs a CRITICAL error in the exception.log.

Magento\Framework\Exception\NoSuchEntityException:
The product with ID "1" does not exist. in [ file path] /ProductRepository.php

These errors are expected but clutter logs in production.

Resolution resolution

Adobe Commerce provides the skipDeletedProductLogging parameter through di.xml, which suppresses CRITICAL errors when deleted products appear in the Last Ordered Items section. The correct implementation depends on the merchant’s installation type.

Option 1: Override the parameter in a custom module (recommended for all installation types)

Create or use an existing custom module.

  1. Override the LastOrderedItems class configuration by adding the parameter in your module’s di.xml:

    < type name=“Magento\Sales\CustomerData\LastOrderedItems”>

    < arguments>

    < argument name=“skipDeletedProductLogging” xsi:type=“boolean”> true< /argument>

    < /arguments>

    < /type>

  2. Deploy the change based on your installation type:
    For Composer-based on-premises installations:

    1. Commit the module changes.

    2. Deploy via your standard process.

    3. Clear cache using:

      bin/magento cache:clean

For Adobe Commerce on cloud infrastructure, deploy through a Cloud release. Cache clears and DI compilation are handled automatically.

Option 2: Apply a Composer patch

If you are using Composer (most installations), directly editing files under vendor/ is unsupported because changes are overwritten on the next Composer update.

Instead, create a patch that modifies the parameter and include it in your project repository.

Official guidance: How to apply a composer patch provided by Adobe.

Composer installation reference: Quick start on‑premises installation.

Verifying the change

Log verification

  • Verify log behavior via New Relic Logs (Adobe Commerce Cloud and many on‑premises merchants).
  • Check var/log/exception.log if no log aggregator is used.

After implementation

  1. Trigger a customer login where deleted products exist.
  2. Confirm that CRITICAL NoSuchEntityException entries no longer appear.

Related reading

recommendation-more-help
experience-cloud-kcs-help-kbarticles