Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Feature Request › Send vendor information by mail to the customer
- This topic has 7 replies, 2 voices, and was last updated 4 years, 6 months ago by pebi44.
- AuthorPosts
- April 22, 2020 at 7:10 pm #121860pebi44Participant
Hello, is this possible to do?
1 – I need the vendor’s contact information to be sent in the email “processing order”.
2 – Show vendor’s contact information at finish checkout.
Thank. - April 22, 2020 at 10:12 pm #121946CraigParticipant
I’m looking for a solution to add this information to the processing order email as well. So that the customer can contact the vendor directly….rather than “replying to the email”.
- April 28, 2020 at 1:57 am #123908pebi44Participant
This code works for me:
add_action( ‘woocommerce_email_order_meta’, ‘add_sellerinfo_to_buyer_email’,50,4 );
function add_sellerinfo_to_buyer_email( $order, $sent_to_admin, $plain_text, $email ) {
global $WCFM;
if ( !in_array( $email->id, array( ‘new_order’,’store-new-order’) )){
$items = $order->get_items();
echo ‘<p>INFORMACION DEL VENDEDOR -</p>’;
foreach ( $items as $item ) {
$product_id = $item->get_product_id();
$vendor_id = wcfm_get_vendor_id_by_post( $product_id );
if( apply_filters( ‘wcfmmp_is_allow_sold_by_linked’, true ) ) {
$store_name = $WCFM->wcfm_vendor_support->wcfm_get_vendor_store_by_vendor( absint($vendor_id) );
} else {
$store_name = $WCFM->wcfm_vendor_support->wcfm_get_vendor_store_name_by_vendor( absint($vendor_id) );
}
$store_user = wcfmmp_get_store( $vendor_id );
$email = $store_user->get_email();
$phone = $store_user->get_phone();
$address = $store_user->get_address_string();
echo $store_name.'(‘.$item->get_name().’) :’.$email.’ ‘.$phone.'<br><br/>’;
}
}
} - April 28, 2020 at 5:56 am #123983CraigParticipant
pebi44 what does that code do? and where do you put in? in Functions.php?
- April 29, 2020 at 8:08 am #124475CraigParticipant
Thanks for that info and clarification pebi44
I received an error on my site when I added that code to my functions.php so I will have to have a closer look at it later on.
Thanks for sharing this code.
- April 29, 2020 at 4:52 pm #124633pebi44Participant
add_action( 'woocommerce_email_order_meta', 'add_sellerinfo_to_buyer_email',50,4 ); function add_sellerinfo_to_buyer_email( $order, $sent_to_admin, $plain_text, $email ) { global $WCFM; if ( !in_array( $email->id, array( 'new_order','store-new-order') )){ $items = $order->get_items(); echo '<p>INFORMACION DEL VENDEDOR -</p>'; foreach ( $items as $item ) { $product_id = $item->get_product_id(); $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); if( apply_filters( 'wcfmmp_is_allow_sold_by_linked', true ) ) { $store_name = $WCFM->wcfm_vendor_support->wcfm_get_vendor_store_by_vendor( absint($vendor_id) ); } else { $store_name = $WCFM->wcfm_vendor_support->wcfm_get_vendor_store_name_by_vendor( absint($vendor_id) ); } $store_user = wcfmmp_get_store( $vendor_id ); $email = $store_user->get_email(); $phone = $store_user->get_phone(); $address = $store_user->get_address_string(); echo $store_name.'('.$item->get_name().') :'.$email.' '.$phone.'<br><br/>'; } } }
- AuthorPosts
- You must be logged in to reply to this topic.