I'm new with shortcodes and programming... I would like to know how to display the store location in a multi vendor site with Dokan plugin when local pickup is selected. I think that Dokan plugin doesn't modify or manage the order, checkout, order confirmation and emails, so this issue is related to how it WooCommerce works. As you know, by default Woocommerce show the name of the method, in this case local pickup, but doesn't show the store address. I would like to have this feature, and display this valuable information in the order, checkout, emails, and invoices. I found the following code but display what I want in each order line, and I would like to display and integrate as a local pickup method description:
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', 10, 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, apply_filters('vendors_sold_by_in_email', __('Email', 'vendors')), $email_vendor);
}
Can someone help me to fix this issue? I think this problem could affect many other users due the Covid-19, many stores want to serve their products with local pickup service. Thank you very much in advance, David