Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save acanza/c7dfb3639b8c2557d69f53518702c10e to your computer and use it in GitHub Desktop.
Save acanza/c7dfb3639b8c2557d69f53518702c10e to your computer and use it in GitHub Desktop.
[WooCommerce] Elimina el botón de añadir al carrito en determinadas páginas de categorías
// Elimina el botón de añadir al carrito en determinadas páginas de categorías
add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons_in_specific_categories', 1 );
function remove_add_to_cart_buttons_in_specific_categories() {
global $post;
$excluded_categories_list = array( 'clothing', 't-shirts' ); //Añade aquí los slugs de las categorías separados por comas.
if( is_product_category( $excluded_categories_list ) ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment