You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何禁用WooCommerce营销功能但保留配送功能?

禁用WooCommerce营销功能导致配送功能失效问题

当前多数解决方案在禁用WooCommerce营销功能的同时,会连带禁用配送功能,具体表现为Local Pickup、Free、Flat Rate这三个默认配送选项的弹窗设置和开关完全失效。

有一类针对WooCommerce >= v4.3的解决方案也存在这个问题:

适用于 WooCommerce >= v4.3
WooCommerce 4.3移除了woocommerce_marketing_menu_items过滤器,原有代码片段不再生效,改用WooCommerce 4.0引入的woocommerce_admin_features过滤器实现:

add_filter( 'woocommerce_admin_features', function( $features ) {
    /**
     * Filter list of features and remove those not needed
     *
     */
    return array_values(
        array_filter( $features, function($feature) {
            return $feature !== 'marketing';
        } )
    );
} );

控制台报错日志如下:

load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.4.2:5 JQMIGRATE: Migrate is installed, version 3.4.1
wc-shipping-zone-methods.min.js?ver=8.4.0:1 Uncaught TypeError: Cannot read properties of undefined (reading 'ShippingCurrencyContext')
    at addCurrencySymbol (wc-shipping-zone-methods.min.js?ver=8.4.0:1:8821)
    at wc-shipping-zone-methods.min.js?ver=8.4.0:1:8505
    at Array.reduce (<anonymous>)
    at n.reformatSettingsHTML (wc-shipping-zone-methods.min.js?ver=8.4.0:1:8491)
    at HTMLAnchorElement.onConfigureShippingMethod (wc-shipping-zone-methods.min.js?ver=8.4.0:1:7102)
    at HTMLBodyElement.dispatch (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.4.2:2:40035)
    at v.handle (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.4.2:2:38006)
addCurrencySymbol @ wc-shipping-zone-methods.min.js?ver=8.4.0:1
(anonymous) @ wc-shipping-zone-methods.min.js?ver=8.4.0:1
reformatSettingsHTML @ wc-shipping-zone-methods.min.js?ver=8.4.0:1
onConfigureShippingMethod @ wc-shipping-zone-methods.min.js?ver=8.4.0:1
dispatch @ load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.4.2:2
v.handle @ load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.4.2:2

内容的提问来源于stack exchange,提问作者Alex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 13:35:30