Woo Snippet: Custom Button Title for Variable Products

updated: 02.08.2021
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_snippet_variable_button_text', 25 );
 
function woo_snippet_variable_button_text( $text ) {
 
	global $product;
	if ( $product->is_type( 'variable' ) ) {
		$text = $product->is_purchasable() ? 'Выбрать объем' : 'Подробнее';
	}
	return $text;
 
}