How to hide specific product in Active Subscriptions block

From aMember Pro Documentation
Jump to: navigation, search

Add this code to site.php file. This example hide product with id 8, you can replace 8 with desired value:

Am_Di::getInstance()->hook->add(Am_Event::BEFORE_RENDER, function(Am_Event $e) {
    if (strpos($e->getTemplateName(), 'member-main-subscriptions.phtml')!==false) {
        $v = $e->getView();
        foreach ($v->member_products as $k => $p) {
            if ($p->pk() == 8) {
                unset($v->member_products[$k]);
                return;
            }
        }
    }
});