Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter vsplven

    (@vsplven)

    Dokan Multivendor

    Plugin Contributor dwpriv

    (@dwpriv)

    @vsplven

    Try this code snippet

    /**
     * Change "vendor:" to "Sold by" for Dokan invoice
     */
    add_filter( 'wpo_wcpdf_shop_name', 'wpo_wcpdf_edit_vendor_name', 10, 2 );
    function wpo_wcpdf_edit_vendor_name( $shop_name, $document ) {
    	if ( ! empty( $document->order && class_exists( 'Dokan_Invoice' ) ) ) {
    		$template_settings = get_option('wpo_wcpdf_settings_general');
    		$dokan_invoice = new Dokan_Invoice();
    		extract( $dokan_invoice->get_order_id_parent_id( $document ) );
    		
            if ( $parent_id == 0 ) {
                if ( function_exists( 'dokan_get_seller_ids_by' ) ) {
                    $seller_list = dokan_get_seller_ids_by( $order_id );
                } else {
                    $seller_list = array_unique( array_keys( dokan_get_sellers_by( $order_id ) ) );
                }
    
                if ( count( $seller_list ) > 1 ) {
                    return $shop_name;
                } else {
                    $vendor_id  = $seller_list[0];
                    $vendor     = dokan()->vendor->get( $vendor_id );
                    $store_name = $vendor->get_shop_name();
                    $store_name = ! empty( $store_name ) ? $store_name : __( 'store_info', 'dokan-invoice' );
    				$shop_name = $template_settings['shop_name']['default'];
                    return $shop_name . "<br /><br />" . __( 'Sold by: ', 'dokan-invoice' ) . $store_name;
                }
    			
            } else {
                $vendor_id  = dokan_get_seller_id_by_order( $order_id );
                $vendor     = dokan()->vendor->get( $vendor_id );
                $store_name = $vendor->get_shop_name();
                $store_name = ! empty( $store_name ) ? $store_name : __( 'store_info', 'dokan-invoice' );
    
                return $shop_name . "<br /><br />" . __( 'Sold by: ', 'dokan-invoice' ) . $store_name;
            }
    	}
    }

    Use this guide to see how to apply this snippet to your website.

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Invoices are not showing the currency symbol correctly’ is closed to new replies.