Support » Plugin: WooCommerce » hide product without redirect

  • Resolved petezeiry

    (@petezeiry)


    Hi everyone, I have woo with wcvendors installed. Currently I have products blocked with a redirect to the log in page. I would like to remove to redirect and instead just have a message for users that dont have permission to access products. I have looked at plugins but none do exactly this without adding tons f other features.

    My currect redirect code is:

    function wpse_131562_redirect() {
    if (!WCV_Vendors::is_vendor(get_current_user_id())
    && (is_product() || is_cart() || is_checkout())
    ) {
    // feel free to customize the following line to suit your needs
    wp_redirect(“/my-account/”);
    exit;
    }
    }
    add_action(‘template_redirect’, ‘wpse_131562_redirect’);

    Just hoping someones knows a code or can give me direction.
    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘hide product without redirect’ is closed to new replies.