Hide "Preview" button for vendors only. Keep it available to admin.

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Product HUB Hide "Preview" button for vendors only. Keep it available to admin.

This topic contains 1 reply, has 2 voices, and was last updated by Avatar Sushobhan 3 months, 1 week ago.

  • Author
    Posts
  • #92633
    Avatar
    BizWizMarketing
    Participant

    How can I hide the “Preview” button for vendors ONL?

    I tried this, but it will remove the “Preview” to the entire site include the admin.
    add_filter( ‘wcfm_is_allow_product_preview’, ‘__return_false’ );

  • #93115
    Avatar
    Sushobhan
    Keymaster

    Hi,
    The hook is correct, all you need is to additionally check for the vendor role.

    function disallow_vendor_product_preview($cap) {
        if(wcfm_is_vendor()) return false;
        return $cap;
    }
    add_filter( 'wcfm_is_allow_product_preview', 'disallow_vendor_product_preview' );

    Let me know if there’s anything else we can help you with.

The topic ‘Hide "Preview" button for vendors only. Keep it available to admin.’ is closed to new replies.