Last active
February 11, 2021 13:00
-
-
Save fervous/c9a09eb789da4bf9b080a3fda98319ed to your computer and use it in GitHub Desktop.
Add Vendor Address and Info to Customer emails Order Confirmation WC Vendors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_add_order_item_meta', 'bwd_add_vendor_to_order_item_meta', 10, 2); | |
function bwd_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 , '_wcv_store_address1', true ); | |
$address2 = get_user_meta( $vendor_id , '_wcv_store_address2', true ); | |
$city = get_user_meta( $vendor_id , '_wcv_store_city', true ); | |
$store_postcode = get_user_meta( $vendor_id , '_wcv_store_postcode', true ); | |
$address = ( $address1 != '') ? $address1 .', ' . $city .', '. $store_postcode :''; | |
wc_add_order_item_meta( $item_id, apply_filters('wcvendors_sold_by_in_email', __('Address', 'wcvendors')), $address); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Thank you very much for your valuable contribution to fix this issue.
It's possible to display the vendor address in the shipping method?
I mean, display the vendor address instead of "local pickup" in the checkout page, customer emails and order confirmation.
If a customer buy more than one product, the fact of to have the vendor address on each order line could be excessive.
Could be possible what I want?
Other solution could be add this information in the order after the shipping method.
Thank you very much.