How to Change WooCommerce “Select Options” text in WooCommerce
add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woo_custom_single_add_to_cart_text’ );
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woo_custom_single_add_to_cart_text’ );
function woo_custom_single_add_to_cart_text() {
return __( ‘ajouter au panier’, ‘woocommerce’ );
}
// define the woocommerce_dropdown_variation_attribute_options_args callback
function filter_woocommerce_dropdown_variation_attribute_options_args( $array ) {
// Find the name of the attribute for the slug we passed in to the function
$attribute_name = wc_attribute_label($array[‘attribute’]);
// Create a string for our select
// $select_text = ‘Select a ‘ . $attribute_name;
$array[‘show_option_none’] = __( ‘personnaliser’, ‘woocommerce’ );
return $array;
};
// add the filter
add_filter( ‘woocommerce_dropdown_variation_attribute_options_args’, ‘filter_woocommerce_dropdown_variation_attribute_options_args’, 10, 1 );
Leave a Reply
You must be logged in to post a comment.