在 WooCommerce 结帐、订单和电子邮件中显示本地取货供应商地址

问题描述

我在 WooCommerce 中使用 Dokan 多供应商插件

我想在选择本地取货送货方式时显示商店位置。

我认为 Dokan 不会更改或管理购物车、结帐、订单和电子邮件通知,因此这个问题与 WooCommerce 的工作方式有关。

认情况下,Woocommerce 显示方法名称,所以在我的例子中是“本地取货”,但不显示商店地址。

我想要这个功能,并在订单、结账、电子邮件和发票中显示这些有价值的信息。

我找到了以下代码

add_action( 'woocommerce_add_order_item_Meta','dp_add_vendor_to_order_item_Meta',10,2);
function dp_add_vendor_to_order_item_Meta( $item_id,$cart_item) {      
        $vendor_id = $cart_item[ 'data' ]->post->post_author;
// build up address 
        $address1           = get_user_Meta( $vendor_id,'billing_address_1',true );
        $address2           = get_user_Meta( $vendor_id,'billing_address_2',true );
        $city               = get_user_Meta( $vendor_id,'billing_city',true ); 
        $store_postcode     = get_user_Meta( $vendor_id,'billing_postcode',true ); 
        $state              = get_user_Meta( $vendor_id,'billing_state',true ); 
        $address            = ( $address1 != '') ? $address1 .',' . $city .',' . $state.','. $store_postcode :''; 
    
    wc_add_order_item_Meta( $item_id,apply_filters('vendors_sold_by_in_email',__('Recoger en','vendors')),$address);
}
add_action( 'woocommerce_add_order_item_Meta','email_add_vendor_to_order_item_Meta',3);
function email_add_vendor_to_order_item_Meta( $item_id,$cart_item) {       
       $vendor_id       = $cart_item[ 'data' ]->post->post_author;
       $email_vendor    = get_userdata( $vendor_id )->user_email;
    
    wc_add_order_item_Meta( $item_id,__('Email',$email_vendor);
}

但它会在每个订单行中显示我想要的内容。相反,我想显示和集成为本地取货方法说明。

我的问题是:选择本地取货时如何显示店铺位置?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)