Skip to content

Instantly share code, notes, and snippets.

@mrgrt
Created May 10, 2018 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrgrt/5fb88c5f757d7f3e39ab5bd9759a2d36 to your computer and use it in GitHub Desktop.
Save mrgrt/5fb88c5f757d7f3e39ab5bd9759a2d36 to your computer and use it in GitHub Desktop.
Change "choose an option" in WooCommerce.
<?php
//Customise the dropdown 'choose an option'
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'wcvdc_dropdown_choice', 10);
// Displays the custom "Choose an option" on the front end
function custom_dropdown_choice( $args ){
global $product;
$args['show_option_none'] = "Select a: " . strtolower(wc_attribute_label($args['attribute'],$product));
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment