【问题标题】:How to add the custom shipping method in woo commerce with out use the woocommerce default shipping options?如何在不使用 woocommerce 默认运输选项的情况下在 woocommerce 中添加自定义运输方式?
【发布时间】:2016-07-05 17:26:56
【问题描述】:

我正在为 woo commerce WordPress 插件开发一个扩展。我想添加自定义运输方式而不使用管理面板运输方式,我想使用临时运输方式来显示不需要注册运输方式如何?

【问题讨论】:

    标签: php wordpress woocommerce


    【解决方案1】:

    您可以在此处找到有关新配送方式 API(自 2.6 起)的所有信息:https://github.com/woothemes/woocommerce/wiki/Shipping-Method-API-(2.6)

    快速回答:如果您想添加新的运输方式,只需使用

    add_filter( 'woocommerce_shipping_methods', 'register_test_method' );
    
    function register_test_method( $methods ) {
       $methods[ 'test_method' ] = 'WC_Shipping_Test_Method';
       return $methods;
    }
    

    刚刚也发现了这个要点,由 Mike Jolley 提出: https://gist.github.com/mikejolley/3b37b9cc19a774665f31

    如果您需要任何帮助来实现此功能,请告诉我。

    【讨论】:

    • ,感谢您的帖子,我已经尝试过它的工作.. 但我会添加一个额外的运输方式结帐显示运输选项.. 但我的要求是不启用运输选项将使用自定义静态运输,方法显示在结帐页面..
    • 您的要求并不完全清楚。是否要添加运输方式?也许您可以添加它并将其设置为不可在购物车中使用。
    猜你喜欢
    • 2022-11-02
    • 1970-01-01
    • 2017-12-23
    • 1970-01-01
    • 2018-03-17
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    • 1970-01-01
    相关资源
    最近更新 更多