woocommerce_variation_option_name

woocommerce_variation_option_name

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.3.3

apply_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&hellip;', '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 .= ‘

    Share this:

  • /includes/wc-template-functions.php line 3252
    			} else {
    				foreach ( $options as $option ) {
    					// This handles < 2.4.0 bw compatibility where text attributes were not sanitized.
    					$selected = sanitize_title( $args&#91;'selected'&#93; ) === $args&#91;'selected'&#93; ? selected( $args&#91;'selected'&#93;, sanitize_title( $option ), false ) : selected( $args&#91;'selected'&#93;, $option, false );
    					$html    .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ) . '</option>';
    				}
    			}
    		}
    
    		$html .= '</select>';
    
    
  • /includes/wc-template-functions.php line 3870
    				}
    				$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;
    
  • /src/StoreApi/Utilities/ProductItemTrait.php line 73
    				 * @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 ),