This one came out of a conversation in my Patreon mentoring Slack room. Someone was having trouble with their Magento 2 object manager configurations (di.xml
) not showing up — but only during checkout. Their problem? They were dropping their di.xml
files into the frontend
folder
etc/frontend/di.xml
This is good enough to get class preferences and plugins set for the page that renders the checkout, as well as any pages that make ajax requests through a frontend controller. However — the stock Magento checkout application also accesses Magento’s rest API directly, and rest API requests happen in a custom area call webapi_rest
. This means di.xml
configuration needs to go into
etc/webapi_rest/di.xml
if Magento’s making a rest request via javascript/ajax and you want your code to run during that request.