Exclude one specific product from a custom css code


I have the following code in my functions php which adds a custom tab to my product listings. Could someone edit this code so that it applies to all listings EXCEPT for product id 2714? This is a gift card product and the whole layout is messed up by the additional tab from this code. I have searched far and wide but any solutions I found didn’t work when I tried to edit the code myself. Thank you so much in advance for your help!!

If excluding a specific product id is not possible, alternatively you could exclude category gift-cards as well. That would have the same end effect I’m looking for.


  • Add a custom product data tab Woocommerce
    add_filter(‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
    function woo_new_product_tab( $tabs ) {

    // Adds the new tab

    $tabs[‘test_tab’] = array(
    ‘title’ => __( ‘How Your Earrings Are Made’, ‘woocommerce’ ),
    ‘priority’ => 50,
    ‘callback’ => ‘woo_new_product_tab_content’

    return $tabs;

function woo_new_product_tab_content() {

// The new tab content

echo '<p>A lot of work went into making these earrings for you. Curious to know more? Check out the general steps below!</p>';
echo '<br class=”clearfix” />';
echo '<img class="alignleft wp-image-606 " src="https://www.wptricks.com/wp-content/uploads/2020/12/For-collections-with-a-meaningful-story.jpg" alt="Infographich showing how I make my polymer clay earrings: Step 1 is the idea, Step 2 is to mix the clay for custom colors, Step 3 is to shape pieces for unique designs and bake them, Step 4 is to clean and sand pieces for a smooth finish, Step 5 is to embed posts and re-bake for durable studs, Step 6 is to drill holes and assemble for OOAK earrings" width="569" height="1088" />';


Suus 8 months 2020-12-10T03:10:21-05:00 0 Answers 17 views 0

Leave an answer