• Resolved andreaschm

    (@andreaschm)


    Hi,
    I am very new to coding and using PHP. I really like your plug in and I think it has a lot of potential, but when the emails are sent both to the admin and the customer the total and the customer notes are not shown.
    Is there a way for me to add it to the child theme template? I have read many entries, but none of them show the complete code and I am not advance enough to know how to write it myself.
    Any help will be appreciated
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author pinal.shah

    (@pinalshah)

    Hi @andreaschm,

    You can try using the function $order_obj->get_customer_note(); to get the customer notes.

    As for the totals, the same will be available in the order object.

    For e.g. you can fetch the order items using $order_obj->get_items() and then loop through it to get the line total & tax for each item in the cart.

    I hope this will help you get started. Please feel free to get in touch if you have any further queries.

    Thanks,
    Pinal

    Thread Starter andreaschm

    (@andreaschm)

    This is the code I have right now:
    `<?php
    /**
    * Request New Quote email
    *
    * @package Quotes for WooCommerce/Emails
    */

    $order_obj = new WC_order( $order->order_id );
    $display_price = false;

    // translators: Site Name.
    $opening_paragraph = __( ‘Ha realizado una solicitud de cotización a %s. Los detalles de los mismos se muestran a continuación:’, ‘quote-wc’ );
    ?>

    <?php do_action( ‘woocommerce_email_header’, $email_heading ); ?>

    <?php
    if ( $order ) :
    ?>
    <p><?php printf( esc_html( $opening_paragraph ), esc_attr( $site_name ) ); ?></p>
    <?php endif; ?>

    <table cellspacing=”0″ cellpadding=”6″ style=”width: 100%; border: 1px solid #eee;” border=”1″ bordercolor=”#eee”>
    <tbody>
    <tr>
    <th style=”text-align:left; border: 1px solid #eee;”><?php esc_html_e( ‘Producto’, ‘quote-wc’ ); ?></th>
    <th style=”text-align:left; border: 1px solid #eee;”><?php esc_html_e( ‘Cantidad’, ‘quote-wc’ ); ?></th>
    <?php
    if ( qwc_order_display_price( $order_obj ) ) {
    $display_price = true;
    ?>
    <th style=”text-align:left; border: 1px solid #eee;”><?php esc_html_e( ‘Precio del producto’, ‘quote-wc’ ); ?></th>
    <?php } ?>

    </tr>
    <?php
    foreach ( $order_obj->get_items() as $items ) {
    ?>
    <tr>
    <td style=”text-align:left; border: 1px solid #eee;”><?php echo wp_kses_post( $items->get_name() ); ?></td>
    <td style=”text-align:left; border: 1px solid #eee;”><?php echo esc_attr( $items->get_quantity() ); ?></td>
    <?php if ( $display_price ) { ?>
    <td style=”text-align:left; border: 1px solid #eee;”><?php echo wp_kses_post( $order_obj->get_formatted_line_subtotal( $items ) ); ?></td>
    <?php } ?>
    </tr>
    <?php
    }
    ?>
    </tbody>
    </table>

    <p><?php esc_html_e( ‘Este pedido está pendiente de cotización.’, ‘quote-wc’ ); ?></p>

    <p><?php esc_html_e( ‘Pronto recibirá un correo electrónico de parte de %s con una cotización.’, ‘quote-wc’ ); ?></p>

    <?php do_action( ‘woocommerce_email_footer’ ); ?>

    How should I add the total for it to appear inside the table?
    Thanks for your help

    Plugin Author pinal.shah

    (@pinalshah)

    Hi @andreaschm,

    You can add the display code for the order total below the foreach loop. Something like below should work.

    <?php
    foreach ( $order_obj->get_items() as $items ) {
    ?>
    <tr>
    <td style=’text-align:left; border: 1px solid #eee;’><?php echo wp_kses_post( $items->get_name() ); ?></td>
    <td style=’text-align:left; border: 1px solid #eee;’><?php echo esc_attr( $items->get_quantity() ); ?></td>
    <?php if ( $display_price ) { ?>
    <td style=’text-align:left; border: 1px solid #eee;’><?php echo wp_kses_post( $order_obj->get_formatted_line_subtotal( $items ) ); ?></td>
    <?php } ?>
    </tr>
    <?php
    }
    ?>
    <?php if ( $display_price ) { ?>
    <tr>
    <td style=’text-align:left; border: 1px solid #eee;’ colspan=’2′><?php echo esc_html__( ‘Total’, ‘quote-wc’ ); ?></td>
    <td style=’text-align:left; border: 1px solid #eee;’><?php echo wp_kses_post( $order_obj->get_total() ); ?></td>
    <?php
    }
    ?>
    </tbody>
    </table>

    Please note that the code is untested. Request you to kindly test before applying on a production site.

    I hope this helps.

    Thanks,
    Pinal

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding full custumer info to email’ is closed to new replies.