Disable Product Pages in WooCommerce

Add the following code to your functions.php file to disable users from accessing product pages within WooCommerce:


/* Remove Links to Access Product Pages */
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );

/* Prevent Users from Accessing Product Pages by Displaying the 404 Page */
function prevent_access_to_product_page(){
    global $post;
    if ( is_product() ) {
        global $wp_query; $wp_query->set_404();
        status_header(404);
    }
}

Other Helpful Articles

What is Webmail?

What is webmail? Webmail is usually a free cloud-based email service that is set up on your hosting. You can use webmail by having a professional-looking email address such as, “[email protected]” and it’s usually at no additional cost. You can also have a professional-looking email with an email client such

Read More »

Use Gmail for Webmail Accounts

If you use Gmail and you have a Webmail account, you can actually use Gmail for your Webmail accounts. There are some benefits, but also drawbacks to using this setup. It is important though that before you take the following steps, you ensure that your DNS records have the correct

Read More »

How To Create an Email Signature in Gmail/G Suite

You may have noticed many businesses and individuals will have email signatures that look professional. If you have Gmail or G Suite, there’s actually a pretty easy way to set one up. To start creating your email signature, sign in to your Gmail account. Over in the top right you’ll

Read More »

What Do You Need Done?:

(Please check all that apply)

Tell Us About You

Almost Done!

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info