WooCommerce Shipping API函数 [英] WooCommerce Shipping API functions

查看:190
本文介绍了WooCommerce Shipping API函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 WooCommerce ,有条件的运输和付款,已安装表格费率插件.我正在尝试为移动设备创建API函数,以从 WordPress WooCommerce 获取运输方法.

I have WooCommerce Conditional shipping & Payment, Table rate plugin installed. I am trying to create an API functions for mobile to get shipping methods from WordPress WooCommerce.

我安装了2个插件,其设置如下Woocommerce有条件运输&支付

i have the 2 plugin install with the settings below Woocommerce conditional shipping & payment

和按表率收费

说我可以得到基本的默认woocommerce发货和正确的计算.但是我怎样才能从2个插件中获得条件限制呢? 我不知道在这2个插件中使用哪种方法来获取条件.

let say i can get the basic default woocommerce shippings and calculation correct. but how can i get the condition restrictions from the 2 plugin? i have no idea which methods in these 2 plugin to use to get the conditions.

如果有人以前做过此事或有任何线索,请帮助谢谢.

If Anyone have done this before or have some clues please helps Thanks.

推荐答案

只需这三行代码,即可从购物车中获取可用的送货方式

Simply this 3 line of code it will get available shipping methods for you from cart items

    global $woocommerce;
    $cart = wc()->cart->get_shipping_packages();
    $shippingMethods =  wc()->shipping->calculate_shipping_for_package($cart);
    return $sm;

这篇关于WooCommerce Shipping API函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆