mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/77941717/change-woocommerce-product-select-options-add-to-cart-button-text
7 lines
317 B
Text
7 lines
317 B
Text
add_filter( 'woocommerce_product_add_to_cart_text', 'replace_loop_add_to_cart_button_text', 20, 2 );
|
|
function replace_loop_add_to_cart_button_text( $text, $product ) {
|
|
if ( $product->is_type( 'variable' ) && $product->is_purchasable() ) {
|
|
$text = __( 'Options', 'woocommerce' );
|
|
}
|
|
return $text;
|
|
}
|