Created
April 24, 2022 06:49
-
-
Save J-H-Mojumder/cdc481c377e1f782aba0152de38bebd5 to your computer and use it in GitHub Desktop.
Adding email address of the vendor under the vendor name in Dokan (https://snipboard.io/G9FSBz.jpg)
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
<?php | |
//Add vendor email alongside the vendor name | |
function add_email_in_cart( $item_data, $cart_item ){ | |
$vendor = dokan_get_vendor_by_product( $cart_item['product_id'] ); | |
if ( ! $vendor || ! $vendor->get_id() ) { | |
return $item_data; | |
} | |
$item_data[] = array( | |
'name' => __( 'Email', 'dokan-lite' ), | |
'value' => $vendor->get_email(), | |
); | |
return $item_data; | |
} | |
add_filter( 'woocommerce_get_item_data', 'add_email_in_cart', 11, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment