Thanks for the feedback..I have placed it to dokan guys but they didn’t respond.Your plugin is already fetching order related buyer information and that is enough.Dokan invoice plugin fetch only seller related information.The above dokan code in link add 4 extra field in dokan store page and user profile.Perhaps,I have done some coding and need your help to hook it in invoice kindly guide me..
I found dokan invoice plugin used add_filter to replace or add more info to your present variables shop_name and shop_address of seller but they don’t have any action hook to hook any fetched data..I saw you have
<?php do_action( 'wpo_wcpdf_after_document_label', $wpo_wcpdf->export->template_type, $wpo_wcpdf->export->order ); ?>
which means it accepts 2 arguments.
But,I have added this in dokan invoice plugin and trying to fetch text field 1 which is company name here:
/**
* Filter Company name
*
* @since 1.1
*
* @global type $wpo_wcpdf
*
* @param type $company_name
*
* @return string $company_name
*/
function wpo_wcpdf_add_dokan_billing_city( $company_name ) {
global $wpo_wcpdf;
// If parent order keep Original Store name else set seller store name
if ( $wpo_wcpdf->export->order->post->post_parent == 0 ) {
if ( function_exists( 'dokan_get_seller_ids_by' ) ) {
$seller_list = dokan_get_seller_ids_by( $wpo_wcpdf->export->order->id );
} else {
$seller_list = array_unique( array_keys( dokan_get_sellers_by( $wpo_wcpdf->export->order->id ) ) );
}
if ( count( $seller_list ) > 1 ) {
return $company_name;
} else {
$seller_id = $seller_list[0];
$store_info = dokan_get_store_info( $seller_id );
$company_name = !empty( $store_info['company_name'] ) ? $store_info['company_name'] : __( 'store_info', 'dokan-invoice' );
return $company_name . '<br /><br />Company Name: ' . $company_name;
}
} else {
$seller_id = $wpo_wcpdf->export->order->post->post_author;
$store_info = dokan_get_store_info( $seller_id );
$company_name = !empty( $store_info['company_name'] ) ? $store_info['company_name'] : __( 'store_info', 'dokan-invoice' );
return $company_name . '<br /><br />Company Name: ' . $company_name;
}
}
As an action hook I am using
add_action( 'wpo_wcpdf_after_document_label', array( $this,'wpo_wcpdf_add_dokan_billing_city'), 10, 1 );
I think the above code cannot fetch the company name in invoice as it does not match with the function format you mentioned in your documentation.
Kindly provide me the right hook statement so that I can make company name appear in invoice..