Home Forums Theme Support Dokan Seller Name/Lastname function in Mail Templates (Woocommerce)

This topic is: resolved

This topic contains 11 replies, has 5 voices, and was last updated by  Aaron M 4 years, 9 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #22191

    Rubens
    Member
    Post count: 5

    Hi, Im trying to integrate the seller name and last name in the email templates when an order is made.

    So I have put admin-new-order.php in wp-content/themes/dokan/woocommerce/emails/ to override the default woocommerce template but or it doesent send, or it doesnt work. I tried with :

    1- < ?php echo $seller_id ?> (Dokan Variable)
    2 –< ?php printf( $order->seller_first_name . ‘ ‘ . $order->seller_last_name ); ?> (Woocommerce variable?)
    3 – < ?php echo %seller_name% ?> (Dokan Variable)
    4 – < ?php printf %seller_name% ?> (Dokan Variable)

    Anybody could help me with that, I'm stuck here

    Thanks in Advance!

    #22202

    Will
    Member
    Post count: 28

    Just a quick thought but double check you're using the actual Dokan theme and not a child theme? If you're not using a child theme I'd suggest you do that so you don't overwrite these emails when you update the theme.

    #22207

    Rubens
    Member
    Post count: 5

    Hi Will, Im using the child theme Thank you for the light ๐Ÿ™‚

    #22208

    Will
    Member
    Post count: 28

    If you're using the child theme then you should be putting it in wp-content/themes/dokan-child/woocommerce/emails/ I believe – not in the Dokan theme.

    #22210

    Rubens
    Member
    Post count: 5

    Yes done. It's safer this way. Still looking how to include the variable ^^

    #22292

    Sk
    Moderator
    Post count: 371

    Hello Rubens,

    you could use the fowlling hook to send mail.

    do_action( 'dokan_checkout_update_order_meta', $order_id );

    $order_id is order post ID. you could get all information through it.

    To write email template please check dokan default templates from dokan/includes/emails
    and check mail sending function from dokan/classes/email.php

    Thank you.

    #24011

    Aaron M
    Member
    Post count: 7

    hi Rubens, you could add the seller info to emails?

    #24016

    Rubens
    Member
    Post count: 5

    >> Sk_Shaikat: Thank you but what I just need is the variables to show the seller First and Last name into the emails.
    >> Aaron: Nop I haven't succeeded to add the seller infos variables into the Mails

    #24436

    Sk
    Moderator
    Post count: 371

    Hello Rubens,

    write this function in dokan/function.php

    function order_email_include_saler_name( $order ) {
            $saler_id = dokan_get_seller_id_by_order( $order->id );
            $saler_info = get_user_by( 'id', $saler_id );
    
            ?>
            <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
                
                <tfoot>
                    <tr>
                        <th scope="row" style="text-align:left; width: 57%; border: 1px solid #eee; <?php  echo 'border-top-width: 4px;'; ?>"><?php _e( 'Saler Name:' ); ?></th>
                        <td style="text-align:left; border: 1px solid #eee; <?php  echo 'border-top-width: 4px;'; ?>"><?php echo $saler_info->display_name; ?></td>
                    </tr>
                </tfoot>
            </table>
            <?php
        }

    and this add action in construct function

    
    add_action( 'woocommerce_email_after_order_table', array( $this, 'order_email_include_saler_name' ) );

    Thank you

    #26068

    SCHAEPPER
    Member
    Post count: 1

    Hi, thanks for this function. Is there a way to change the parameter to show the shop name instead of the Seller Name? The shop name is more meaningful for the buyer than the seller name. Thanks in advance for any tips.

    #26112

    Sk
    Moderator
    Post count: 371

    Hello SCHAEPPER,
    just use the following function rather than that.

    [php]
    function order_email_include_saler_name( $order ) {
    $saller_id = dokan_get_seller_id_by_order( $order->id );
    $store_info = dokan_get_store_info( $saller_id );

    ?>
    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">

    <tfoot>
    <tr>
    <th scope="row" style="text-align:left; width: 57%; border: 1px solid #eee; <?php echo ‘border-top-width: 4px;'; ?>"><?php _e( ‘Store Name:' ); ?></th>
    <td style="text-align:left; border: 1px solid #eee; <?php echo ‘border-top-width: 4px;'; ?>"><?php echo esc_html( $store_info[‘store_name'] ); ?></td>
    </tr>
    </tfoot>
    </table>
    <?php
    }
    [/php]

    Thank you ๐Ÿ™‚

    #26125

    Aaron M
    Member
    Post count: 7

    works perfect, thanks sk_shaikat

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘Seller Name/Lastname function in Mail Templates (Woocommerce)’ is closed to new replies.