Home Forums WC Vendors Free Support Vendors details in order_details_customer.php Reply To: Vendors details in order_details_customer.php

#11880
CriterioNet
Participant

If another need this, so I did:

copy template (yourtheme/woocommerce/order/order_details.php)

in order_details.php changue las line:
wc_get_template( 'order/order-details-customer.php', array( 'order' => $order, 'item' => $item ) );

in order-details-customer.php add:


<!-- datos del vendedor -->
<div class="col-2">

<header>
<h2><?php _e( 'Vendor Details', 'woocommerce' ); ?></h2>
</header>

<?php foreach( $order->get_items() as $item_id => $item ) { ?>

<?php
$product_name = $item['name'];
$product_id = $item['product_id'];
$vendor_id = get_post_field( 'post_author', $product_id );
$vendor_data = get_userdata( $vendor_id );
$vendor_email = $vendor_data->user_email;
$vendor_name = WCV_Vendors::is_vendor( $vendor_id ) ? sprintf( WCV_Vendors::get_vendor_sold_by( $vendor_id ) ): get_bloginfo( 'name' );
$vendor_phone = get_user_meta($vendor_id, 'billing_phone', true);
$vendor_details = ' Producto: ' . $product_name . ' <br> Artesano: '.$vendor_name . '<br> Email: ' . $vendor_email . '<br> Teléfono: ' .$vendor_phone;
echo $vendor_details;
?>
<hr>
<?php } ?>

</div>
<!-- /datos del vendedor -->

If there are several products on the order are displayed correctly identifying the vendor by the name of the product.

Thanks Ben for your help!

This website uses cookies to ensure you get the best experience on our website.