PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, May 9, 2022

[FIXED] How to hide Woocommerce product Description tab only for unlogged users?

 May 09, 2022     hook-woocommerce, php, product, woocommerce, wordpress     No comments   

Issue

How to hide product "Description" tab' in Woocommerce plugin only for unlogged users, but visible for registered customers (and logged-in users).


Solution

To remove product description tab on sigle product pages for non logged users, you will use:

add_filter( 'woocommerce_product_tabs', 'customize_product_tabs', 100 );
function customize_product_tabs( $tabs ) {

    if ( ! is_user_logged_in() ) { 
        unset( $tabs['description'] ); // remove the description tab
    }

    return $tabs;
}

This code goes in functions.php file of your active child theme (or active theme). Tested and works.



Answered By - LoicTheAztec
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing