woocommerce_variation_option_name
woocommerce_variation_option_name
Appears in: woocommerce.3.4.2, woocommerce.3.4.4, woocommerce.3.4.5, woocommerce.3.4.6, woocommerce.3.4.7, woocommerce.3.5.0, woocommerce.3.5.1, woocommerce.3.5.2, woocommerce.3.5.3, woocommerce.3.5.4, woocommerce.3.5.5, woocommerce.3.5.6, woocommerce.3.5.7, woocommerce.3.5.8, woocommerce.3.6.1, woocommerce.3.6.2, woocommerce.3.6.3, woocommerce.3.6.4, woocommerce.3.6.5, woocommerce.3.7.0, woocommerce.3.7.1, woocommerce.3.8.0, woocommerce.3.8.1, woocommerce.3.9.0, woocommerce.3.9.1, woocommerce.3.9.2, woocommerce.3.9.3, woocommerce.4.0.0, woocommerce.4.0.1, woocommerce.4.1.0, woocommerce.4.1.1, woocommerce.4.2.0, woocommerce.4.2.1, woocommerce.4.3.0, woocommerce.4.3.1, woocommerce.4.3.2, woocommerce.4.3.3, woocommerce.4.4.0, woocommerce.4.4.1, woocommerce.4.5.1, woocommerce.4.5.2, woocommerce.4.6.0, woocommerce.4.6.1, woocommerce.4.6.2, woocommerce.4.7.0, woocommerce.4.7.1, woocommerce.4.8.0, woocommerce.4.9.0, woocommerce.4.9.1, woocommerce.4.9.2, woocommerce.5.0.0, woocommerce.5.1.0, woocommerce.5.2.0, woocommerce.5.2.1, woocommerce.5.2.2, woocommerce.5.3.0, woocommerce.5.4.0, woocommerce.5.4.1, woocommerce.5.5.0, woocommerce.5.5.1, woocommerce.5.5.2, woocommerce.5.6.0, woocommerce.5.6.1, woocommerce.5.7.0, woocommerce.5.7.1, woocommerce.5.8.0, woocommerce.6.3.1, woocommerce.6.4.1, woocommerce.6.5.1, woocommerce.6.6.1, woocommerce.6.7.0, woocommerce.6.8.0, woocommerce.6.8.1, woocommerce.6.8.2, woocommerce.6.9.0, woocommerce.6.9.4, woocommerce.7.0.0, woocommerce.7.1.0, woocommerce.7.1.1, woocommerce.7.2.2, woocommerce.7.3.0, woocommerce.7.4.0, woocommerce.7.4.1, woocommerce.7.5.1, woocommerce.7.6.0, woocommerce.7.6.1, woocommerce.7.7.0, woocommerce.7.7.1, woocommerce.7.8.1, woocommerce.7.9.0, woocommerce.8.0.2, woocommerce.8.0.3, woocommerce.8.1.1, woocommerce.8.2.1, woocommerce.8.2.2, woocommerce.8.3.1, woocommerce.8.4.0, woocommerce.8.5.1, woocommerce.8.5.2, woocommerce.8.6.0, woocommerce.8.6.1, woocommerce.8.7.0, woocommerce.8.8.3, woocommerce.8.9.2, woocommerce.8.9.3, woocommerce.9.0.2, woocommerce.9.1.2, woocommerce.9.1.4, woocommerce.9.2.2, woocommerce.9.2.3, woocommerce.9.3.1, woocommerce.9.3.3
Hook Type: filter
Displaying hooks found in version: woocommerce.9.3.3apply_filters('woocommerce_variation_option_name') is found 8 times:
- /includes/admin/meta-boxes/views/html-product-data-variations.php line 53
<option value=""><?php echo esc_html( sprintf( __( 'No default %s…', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ) ); ?></option> <?php if ( $attribute->is_taxonomy() ) : ?> <?php foreach ( $attribute->get_terms() as $option ) : ?> <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?> <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> <?php /* phpcs:enable */ ?> <?php endforeach; ?> <?php else : ?> <?php foreach ( $attribute->get_options() as $option ) : ?> <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?> <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>
- /includes/admin/meta-boxes/views/html-product-data-variations.php line 59
get_options() as $option ) : ?>
- /includes/admin/meta-boxes/views/html-variation-admin.php line 42
</option> <?php if ( $attribute->is_taxonomy() ) : ?> <?php foreach ( $attribute->get_terms() as $option ) : ?> <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?> <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> <?php /* phpcs:enable */ ?> <?php endforeach; ?> <?php else : ?> <?php foreach ( $attribute->get_options() as $option ) : ?> <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?> <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>
- /includes/admin/meta-boxes/views/html-variation-admin.php line 48
get_options() as $option ) : ?>
- /includes/wc-template-functions.php line 3245
);
foreach ( $terms as $term ) {
if ( in_array( $term->slug, $options, true ) ) {
$html .= ‘
} else { foreach ( $options as $option ) { // This handles < 2.4.0 bw compatibility where text attributes were not sanitized. $selected = sanitize_title( $args['selected'] ) === $args['selected'] ? selected( $args['selected'], sanitize_title( $option ), false ) : selected( $args['selected'], $option, false ); $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ) . '</option>'; } } } $html .= '</select>';
} $label = wc_attribute_label( $taxonomy ); } else { // If this is a custom option slug, get the options name. $value = apply_filters( 'woocommerce_variation_option_name', $value, null, $taxonomy, $cart_item['data'] ); $label = wc_attribute_label( str_replace( 'attribute_', '', $name ), $cart_item['data'] ); } // Check the nicename against the title. if ( '' === $value || wc_is_attribute_in_product_name( $value, $cart_item['data']->get_name() ) ) { continue;
* @param string $taxonomy Taxonomy or product attribute name. * @param \WC_Product $product Product data. * @return string */ $value = apply_filters( 'woocommerce_variation_option_name', $value, null, $taxonomy, $product ); $label = wc_attribute_label( str_replace( 'attribute_', '', $key ), $product ); } $return[] = [ 'attribute' => $this->prepare_html_response( $label ), 'value' => $this->prepare_html_response( $value ),