只有当用户进入特定类别时,才有办法按价格订购产品吗?
我知道我可以使用函数中的挂钩来实现这一点。php,但我不确定如何实现这一点
add_filter(\'function-for-ordering-products\',\'my-custom-function\');
function my-custom-function(){
//Step 1. Find the category the user is currently watching
//Step 2. If the category is "Giftcards" go to step 3
//Step 2.1 If the category is not "Giftcards" go to step 4
//Step 3. Set products order by price
//Step 4. Do nothing
}
你能帮我一下吗?
在Add\\u filter中,我是否需要在shop\\u循环之前使用woocommerce\\u?
所以正确的过滤器应该是。。。
add_filter(\'woocommerce_before_shop_loop
\',\'my-custom-function\')?