Hide specific product in Active Subscriptions block
Add the following code to the site.php file. This example hides the product with ID 8 from
the Active Subscriptions block. Replace 8 with the ID of the product you want to hide.
Am_Di::getInstance()->hook->add(Am_Event::BEFORE_RENDER, function (Am_Event $event) {
$template = str_replace('\\', '/', $event->getTemplateName());
if (strpos($template, 'blocks/member-main-subscriptions.phtml') === false) {
return;
}
$productId = 8;
$view = $event->getView();
foreach ($view->member_products as $key => $product) {
if ((int) $product->pk() === $productId) {
unset($view->member_products[$key]);
break;
}
}
});