add_filter( 'woocommerce_product_add_to_cart_text', 'bbloomer_archive_custom_cart_button_text' ); function bbloomer_archive_custom_cart_button_text() { global $product; $terms = get_the_terms( $product->ID, 'product_cat' ); foreach ($terms as $term) { $product_cat = $term->name; break; } switch($product_cat) { case 'category1'; return 'Category 1 DAFTAR / TEMPAH'; break; case 'category2'; return 'Category 2 DAFTAR / TEMPAH'; break; // case 'category3'; etc... // return 'Category 3 button text'; break; default; return 'DAFTAR / TEMPAH'; 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