woocommerce_variation_option_name хук-фильтрWC 2.5.0

Filters the variation option name.

Filters the variation option name for custom option slugs.

Использование

add_filter( 'woocommerce_variation_option_name', 'wp_kama_woocommerce_variation_option_name_filter', 10, 4 );

/**
 * Function for `woocommerce_variation_option_name` filter-hook.
 * 
 * @param string      $value    The name to display.
 * @param null        $unused   Unused because this is not a variation taxonomy.
 * @param string      $taxonomy Taxonomy or product attribute name.
 * @param \WC_Product $product  Product data.
 *
 * @return string
 */
function wp_kama_woocommerce_variation_option_name_filter( $value, $unused, $taxonomy, $product ){

	// filter...
	return $value;
}
$value(строка)
The name to display.
$unused(null)
Unused because this is not a variation taxonomy.
$taxonomy(строка)
Taxonomy or product attribute name.
$product(\WC_Product)
Product data.

Список изменений

С версии 2.5.0 Введена.

Где вызывается хук

В файле: /src/StoreApi/Utilities/ProductItemTrait.php
woocommerce_variation_option_name
woocommerce/src/StoreApi/Utilities/ProductItemTrait.php 73
$value = apply_filters( 'woocommerce_variation_option_name', $value, null, $taxonomy, $product );
woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php 42
<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, $attribute->get_name(), $product_object ) ); ?></option>
woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php 48
<option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php 53
<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, $attribute->get_name(), $product_object ) ); ?></option>
woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php 59
<option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
woocommerce/includes/wc-template-functions.php 3233
$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, $term, $attribute, $product ) ) . '</option>';
woocommerce/includes/wc-template-functions.php 3240
$html    .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ) . '</option>';
woocommerce/includes/wc-template-functions.php 3849
$value = apply_filters( 'woocommerce_variation_option_name', $value, null, $taxonomy, $cart_item['data'] );

Где используется хук в WooCommerce

Использование не найдено.