Skip to content

Instantly share code, notes, and snippets.

@J-H-Mojumder
Created April 24, 2022 06:49
Show Gist options
  • Save J-H-Mojumder/cdc481c377e1f782aba0152de38bebd5 to your computer and use it in GitHub Desktop.
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)
<?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