在Dokan插件中,没有真正的供应商仓库地址.
您可以通过Order Items从定义的WC_Order对象$order
获取供应商详细信息:
// Loop through order "line items"
foreach ( $order->get_items() as $item ) {
$author_id = get_post_field( 'post_author', $item->get_product_id() );
$vendor = dokan()->vendor->get($author_id);
$shop_name = $vendor->get_shop_name(); // <== Shop name
$first_name = $vendor->get_first_name(); // <== First name
$last_name = $vendor->get_first_name(); // <== Last name
$address = $vendor->get_address(); // <== Address
$location = $vendor->get_location(); // <== Location
$phone = $vendor->get_phone(); // <== Phone
$email = $vendor->get_email(); // <== Email
}
供应商可以定义仓库地址的唯一情况是在启用货到付款发货选项时,可以在"Description"字段中有 Select 地定义仓库地址.看它here in the documentation.
这个仓库地址应该存储在数据库中的Dokan专有表中,就像WooCommerce中的there is NO description field个货到付款发货选项一样.
该仓库地址可以从定义的WC_Order对象$order
中的订单中获得(无需任何担保),以"发货"物品:
// Loop through order "line items"
foreach ( $order->get_items('shipping') as $item ) {
// raw output shipping data
print_r($item->get_data());
// raw output shipping meta data
print_r($item->get_meta_data());
}
我希望这会有帮助.
相关: