Woocommerce: sorting variable product

How do I show variations sorted by quantity in stock? I can override or extend the WC_Product_Variable class, but this s

How do I show variations sorted by quantity in stock? I can override or extend the WC_Product_Variable class, but this solution doesn't seem optimal. What other options are there?

How do I show variations sorted by quantity in stock? I can override or extend the WC_Product_Variable class, but this solution doesn't seem optimal. What other options are there?

Share Improve this question edited Apr 16, 2019 at 13:09 Alexander Taurus asked Apr 16, 2019 at 6:57 Alexander TaurusAlexander Taurus 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can use the woocommerce_get_children filter:

function wpse_filter_variations( $variations, $product, $false ) {
    // Do you sorting here

    return $variations;
}
add_filter( 'woocommerce_get_children', 'wpse_filter_variations', 10, 3 );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745583489a4634391.html

相关推荐

  • Woocommerce: sorting variable product

    How do I show variations sorted by quantity in stock? I can override or extend the WC_Product_Variable class, but this s

    12小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信