Merge pull request #8774 from Ninos/dropdown
Add class arg to dropdown function
This commit is contained in:
commit
fd22334fe6
|
@ -1911,6 +1911,7 @@ if ( ! function_exists( 'wc_dropdown_variation_attribute_options' ) ) {
|
|||
'selected' => false,
|
||||
'name' => '',
|
||||
'id' => '',
|
||||
'class' => '',
|
||||
'show_option_none' => __( 'Choose an option', 'woocommerce' )
|
||||
) );
|
||||
|
||||
|
@ -1919,13 +1920,14 @@ if ( ! function_exists( 'wc_dropdown_variation_attribute_options' ) ) {
|
|||
$attribute = $args['attribute'];
|
||||
$name = $args['name'] ? $args['name'] : 'attribute_' . sanitize_title( $attribute );
|
||||
$id = $args['id'] ? $args['id'] : sanitize_title( $attribute );
|
||||
$class = $args['class'];
|
||||
|
||||
if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) {
|
||||
$attributes = $product->get_variation_attributes();
|
||||
$options = $attributes[ $attribute ];
|
||||
}
|
||||
|
||||
echo '<select id="' . esc_attr( $id ) . '" name="' . esc_attr( $name ) . '" data-attribute_name="attribute_' . esc_attr( sanitize_title( $attribute ) ) . '">';
|
||||
echo '<select id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '" name="' . esc_attr( $name ) . '" data-attribute_name="attribute_' . esc_attr( sanitize_title( $attribute ) ) . '">';
|
||||
|
||||
if ( $args['show_option_none'] ) {
|
||||
echo '<option value="">' . esc_html( $args['show_option_none'] ) . '</option>';
|
||||
|
|
Loading…
Reference in New Issue