add_filter( 'woocommerce_product_add_to_cart_text', 'ayudawp_texto_carrito_por_categoria' ); function ayudawp_texto_carrito_por_categoria() { global $product; $terms = get_the_terms( $product->ID, 'product_cat' ); foreach ($terms as $term) { $product_cat = $term->name; break; } switch($product_cat) { case 'categoria1'; //Nombre de una categoría return 'Texto del botón para la categoría 1'; break; case 'categoria2'; return 'Texto del botón para la categoría 1'; break; default; return 'Texto del botón por defecto para el resto de categorías'; break; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter