我在我的网站上使用Woo Commerce,在一个产品上有多个变体。如果我使产品“缺货”,如何删除或删除所选的变体?我曾尝试在Woo Commerce设置中使用“隐藏缺货”,尽管这没有什么不同。
如果缺货,请禁用WOO商务的变体
1 个回复
最合适的回答,由SO网友:user2634611 整理而成
设法解决了我自己的问题。
只需将以下内容粘贴到函数中即可。php
function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 10;
}
add_filter( \'woocommerce_ajax_variation_threshold\', \'custom_wc_ajax_variation_threshold\', 10, 2 );
然后更改“return 10;”无论你有多少变化。Please note this may slow down page loading time depending on your hosting.