最后,我这样做了:
function bo_disable_stock_check(){
if(bo_cart_contain_birthlist()){
remove_action(\'woocommerce_check_cart_items\', [WC()->cart, \'check_cart_items\'], 1);
add_filter("woocommerce_product_is_in_stock", "__return_true");
add_filter("woocommerce_cart_item_required_stock_is_not_enough", "__return_false");
}
}
add_action(\'wp\',\'bo_disable_stock_check\');
但也许有更多的特定钩子可以调用,而不是;wp";。