2017-07-27 72 views
1

我可以從結算和運輸中取消設置字段,但爲什麼我無法取消設置其他字段的字段。我在這些領域添加了一個條件。也許我正在使用錯誤的元鍵。在結帳時取消設置自定義字段 - woocommerce

function wc_remove_checkout_field($fields) { 
    unset($fields['billing']['test_field']); //this one working 
    unset($fields['additional']['delivery_time']); //this one not even if I replace additional with order. 


    return $fields; 
} 
add_filter('woocommerce_checkout_fields' , 'wc_remove_checkout_field'); 

創建領域usings這個插件WooCommerce Checkout Field Editor

回答

0

您可以使用此過濾器刪除訂單備註字段:如果你想堅持使用unset你的方法

add_filter('woocommerce_enable_order_notes_field', '__return_false'); 

,你需要用「訂單」替換「附加」:

unset($fields['order']['order_comments']); 
+0

這對我都有用。我無法取消使用此插件創建的那些字段。我是基於購物車中的產品類別創造條件的。 – Stunomatic

+0

如果它與插件相關,請嘗試聯繫插件作者 – Avishay28

相關問題