WooCommerce Shipping API函数 [英] WooCommerce Shipping API functions
问题描述
我有 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屋!