Skip to content

Instantly share code, notes, and snippets.

@anwas
Last active February 22, 2018 09:05
Show Gist options
  • Save anwas/fa41cb4addfb1dce091ca1952d60c713 to your computer and use it in GitHub Desktop.
Save anwas/fa41cb4addfb1dce091ca1952d60c713 to your computer and use it in GitHub Desktop.
[WC Variation Dropdown Text] #wordpress #woocommerce #plugins #php
<?php
/**
* Plugin Name: WC Variation Dropdown Text
* Plugin URI: http://gelazius.eu
* Description: WC Variation Dropdown Text plugin replaces the default WooCommerce variation text from "Choose an option" to the current attribute title.
* Version: 1.0
* Author: Vytenis Gelažius
* Author URI: http://gelazius.eu
**/
if (!defined('ABSPATH')) {
die('-1');
}
function WC_Variation_Dropdown_Options($args) {
$args['show_option_none'] = __($args["attribute"], 'woocommerce');
return $args;
}
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'WC_Variation_Dropdown_Options', 10, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment