woocommerce_variation_option_name

The WooCommerce woocommerce variation option name hook.

Description

apply_filters( 'woocommerce_variation_option_name', (string) $term_name ); 

Parameters (1)

0. $term_name (string)
The term name.

Usage

To run the hook, copy the example below.
  1. $term_name = apply_filters( 'woocommerce_variation_option_name', $term_name ); 
  2.  
  3. if ( !empty( $term_name ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_variation_option_name callback 
  2. function filter_woocommerce_variation_option_name( $term_name ) { 
  3. // make filter magic happen here... 
  4. return $term_name
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_variation_option_name', 'filter_woocommerce_variation_option_name', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_variation_option_name', 'filter_woocommerce_variation_option_name', 10, 1 ); 

Defined (7)

The filter is defined in the following location(s).

/includes/wc-template-functions.php  
  1. $html .= '<option value="' . esc_attr( $term->slug ) . '" ' . selected( sanitize_title( $args['selected'] ), $term->slug, false ) . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '</option>'; 
  1. $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>'; 
/includes/class-wc-cart.php  
  1. $value = apply_filters( 'woocommerce_variation_option_name', $value ); 
/includes/admin/meta-boxes/views/html-variation-admin.php  
  1. <option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name ) ); ?></option> 
  1. <option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ); ?></option> 
/includes/admin/meta-boxes/views/html-product-data-variations.php  
  1. <option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name ) ); ?></option> 
  1. <option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ); ?></option>