Woocommerce variation sort
-
In woocommerce/single-product/add-to-cart/variable.php i found the part where the dropdown menu is being formed. I want to sort the variations like natsort(); so like:
1
2
10At the moment the variable products are being sorted on alphabet:
1
10
2Is there a way to edit the code below to sort it that way?
<?php foreach ( $attributes as $attribute_name => $options ) : ?>
<tr>
<td class=”label”><label for=”<?php echo sanitize_title( $attribute_name ); ?>”><?php echo wc_attribute_label( $attribute_name ); ?></label></td>
<td class=”value”><?php
$selected = isset( $_REQUEST[ ‘attribute_’ . sanitize_title( $attribute_name ) ] ) ? wc_clean( $_REQUEST[ ‘attribute_’ . sanitize_title( $attribute_name ) ] ) : $product->get_variation_default_attribute( $attribute_name );
wc_dropdown_variation_attribute_options( array( ‘options’ => $options, ‘attribute’ => $attribute_name, ‘product’ => $product, ‘selected’ => $selected ) );
?>
</td>
</tr><?php endforeach;?>
- Het onderwerp ‘Woocommerce variation sort’ is gesloten voor nieuwe reacties.