Support » Plugin: MarketPress - WordPress eCommerce » Reorder product variations

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @zanzaboonda,

    Thank you for your question.

    Unfortunately currently there isn’t any option in the plugin to change order of variation.

    You can just enter variations in alphabetical order.

    Alternatively you can add the following code in functions.php file of your child theme or use plugin like following to sort variations using JavaScript in front end. ( Test the plugin in development site before using it in production site )

    function add_js_in_footer(){ ?>
    <script type="text/javascript">
    var options = jQuery('select.mp_product_variations option');
    var arr =, o) { return { t: jQuery(o).text(), v: o.value }; }).get();
    arr.sort(function(o1, o2) { return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0; });
    options.each(function(i, o) {
      o.value = arr[i].v;
    <?php }
    add_action('wp_footer', 'add_js_in_footer');

    Note: This code will only sort variations if JavaScript is enabled in the browser.

    Best Regards,

    Hey there.

    We haven’t heard from you in awhile, so I just wanted to check in to make sure all was good.

    This thread was marked resolved, but please, if you still need help then just respond and open it back up. We can then take it from there. 🙂

    Hope you have a fantastic day!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Reorder product variations’ is closed to new replies.