• Resolved kohopetr

    (@kohopetr)


    Hello, could you please help me to write a function to remove potter woo add to cart button from specficic category?
    I was able to add the code that hides the button for product detail – thats woocommerce function:

    function remove_product_description_add_cart_button(){
    global $product;

    // Set HERE your category ID, slug or name (or an array)
    $category = ‘predplatne-pro-skoly’;

    //Remove Add to Cart button from product description of product with id 1234
    if ( has_term( $category, ‘product_cat’, $product->id ) )
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

    }
    add_action(‘wp’,’remove_product_description_add_cart_button’);

    Could you advice how to hide it using potter add to cart button in category loop? thanks

    • This topic was modified 4 years, 6 months ago by kohopetr.
    • This topic was modified 4 years, 6 months ago by kohopetr.
    • This topic was modified 4 years, 6 months ago by kohopetr.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Potter

    (@wppotter)

    Hi,

    Thanks for writing in.
    Potter Product category or Shop loops are customized. It gives freedom to the user if they want to show or hide any item in the loop.
    https://tinyurl.com/y9o6nvu5

    If you want to hide it for a particular category of product you can use a simple CSS code to do this.

    .woocommerce-page ul.products li.product.product_cat-predplatne-pro-skoly .add_to_cart_button {
      display: none;
    }

    Please change the “predplatne-pro-skoly” from the CSS class with your category slug if you want to hide in different category.
    You can use it for multiple categories. It will remove the button from the mentioned category of products in all loop pages.
    Use this CSS in customizer custom CSS so that it won’t affect when updating the theme.

    Hope this helps!

    If you are like the theme please feel free to add a 5star rating with a comment, so that it will help us to improve the product.

    Thanks again!

    • This reply was modified 4 years, 6 months ago by Potter.
    Thread Starter kohopetr

    (@kohopetr)

    Thanks it works:)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘woo specific category products loop – hide add to cart button’ is closed to new replies.