Problem With Custom Add-On + Cscart Sdk: Symlinked Template Not Working With Smarty Cache

Just wanted to raise an issue in case no one is aware – or perhaps I'm doing something wrong since I'm very new to the platform.

I wanted to create a custom add-on that hooked into the "body" hook, before the hook. So in my add-on directory I created the file:


I'm using the symlink method with the SDK, so I ran

vendor/bin/cscart-sdk addon:symlink my_addon ~/projects/projectname/addons/my_addon public/

vendor/bin/cscart-sdk addon:symlink my_addon ~/projects/projectname/addons/my_addon public/ --templates-to-design

This appeared to symlink everything in the proper place, including my addon.xml file. The add-on shows up for installation, but the template hook never works. I lost hours to this, until I realized that if I manually created the add-on directory in the design/themes/ it *did* work. I tried turning off disabling symlinks in nginx to see if that's the issue but it didn't help.

Strangely, I think this is a deeper issue than just symlinks (maybe?) because if I disable the hook cache in smarty_plugins/block.hook.php by commenting this line out:

// Registry::registerCache($hook_name, ['addons'], Registry::cacheLevel(['static', 'storefront']));

It totally works.
I've been able to move past this issue because I can simply upload my add-on as a zip file. But I have to remember to copy all my modifications out of design/themes back into my own addon directory (which I'm checking into git.) The cscart sdk method would be much, much better – and it seems like you know that too, because you promote it as the way to work with add-ons that are stored in git. But it doesn't work, at least not for me in this use case. I'll work around it for now but I thought it might be useful or interesting or helpful to someone else before they tear their hair out like I did :) .