Hi - I am looking to pass through specific OG:IMAGE text lines depending ont eh storefront in theme file.
What is the code/varialbe please to check teh storefront ID?
Thanks - ADam.
Hi - I am looking to pass through specific OG:IMAGE text lines depending ont eh storefront in theme file.
What is the code/varialbe please to check teh storefront ID?
Thanks - ADam.
You can use
$storefront_id = StorefrontProvider::getStorefront()->storefront_id;
do not forget to add this line of code to the top of the php file
use Tygh\Providers\StorefrontProvider;
In your addon, add `controllers/frontend/init.post.php` with the following content:
use Tygh\Tygh;Tygh::$app[‘view’]->assign(‘storefront’, Tygh::$app[‘storefront’]);
Now you can use the following template code to get the storefront ID anywhere:
{if $storefront->storefront_id === 1} {/if}{if $storefront->url === “example.com”}
{/if}
The latter works best for readability imo
Thanks the above worked great after changing the === to ==