在Wordpress Woocommerce中,我创建了一个分组产品,其中包含许多子产品(子产品).我尝试到处搜索,但我找不到一个可行的解决方案,如何通过SKU或产品名称来订购它们.似乎它的orderby仅由"菜单顺序"生成.虽然由于我在这些多个分组产品中有30多个子产品,但是按照菜单顺序值来订购它们将非常浪费时间.
我尝试了以下代码,但似乎它在WC 2.5中有效,但不是3.0+.
add_filter( 'woocommerce_grouped_children_args',
'so_22661392_grouped_children_args' );
function so_22661392_grouped_children_args( $args ){
$args['meta_key'] = 'sku';
$args['orderby'] = 'meta_value';
$args['order'] = 'ASC';
return $args;
}
Run Code Online (Sandbox Code Playgroud)
我还搜索了谷歌的解释,但找不到任何解释.我试图清除瞬态,这不起作用:
WooCommerce>System Status>Tools>Clear Transients
Run Code Online (Sandbox Code Playgroud)
可以在https://plastmet.ee/uus/toode/umartoru-kork-zzo-pealekaiv/上查看分组的产品.html表应与下面的子项匹配,但事实并非如此.儿童SKU是"563/9005","567/9005"等.
任何帮助将不胜感激!
我使用进口商向商店进口数千种产品.虽然我想在销售商品之前插入产品的图片和说明.
如果没有分配缩略图,我想隐藏商店中的产品.这样,只有在我设置缩略图图像后才能在商店中看到新产品.
我在header.php中试过这个,但是没有用:
<?php if($_product->getImage() && $_product->getImage() != 'no_selection'){
?>
<style>
/* Css to hide Featured image Div */
</style>
<?php
}?>
Run Code Online (Sandbox Code Playgroud)
这给了我错误:
致命错误:在非对象上调用成员函数getImage()
如果他们没有放置缩略图,有没有快速的方法从商店页面隐藏WordPress WooCommerce产品?
谢谢