Add total sum from vendor inside the customer email template

WCMp Core

Add total sum from vendor inside the customer email template Open

Viewing 9 reply threads
  • Author
    Posts
    • #92284
      itunes_schreiber
      Participant

      Hi,
      sorry for spamming you with another thread.
      But I would need again your assist.

      I would like to customize the customer email template so that the total costs of each vendor will be shown separately in the mail.
      At the moment only the total costs of the order will be displayed for the customer mail template.
      But in my case, the total costs of each vendor is needed, because the payment is not going automatically in my shop-concept.

      Therefore, if the customer don’t get this separately, he would need to calculate by himself which vendor is receiving how much money (calculating / check shipping of each vendor & calculating tax for each vendor -> unreasonable).

      I have seen that inside the vendor mail there will be the sum for each vendor, which he will get paid.
      This costs is what I need for every vendor inside the customer order mail.

      Could you please assist once again?
      Thanks & keep up the great work you are doing here.

    • #92359

      Hi @itunes_schreiber,
      You can simply display every vendor commision from an order by useing

      
      $order_id = 'your order id';
      $commission_id = get_post_meta( $order_id , '_commission_id', true );
      $commission_total = get_post_meta( $commission_id , '_commission_total', true );
      Copy
    • #92385
      itunes_schreiber
      Participant

      Hi Raju,

      thanks for the reply.
      But sorry, can you please provide some more / further details?
      My php knowledge is not the best…

      What is meant by “your order id”?
      Because as I understand, I would need the actual order ID for the actual order-mail which will be sent to the customer (order confirmation)?
      How can I do this?

      As I understand as well, I need to do the customization inside the customer-on-hold-order.php file from WooCommerce and there are only used “do_actions” functions.
      So it’s not clear for me how to implement your code snippet.

      Can you may please give me an example?

      Regards,
      Lukas

    • #92425

      @itunes_schreiber, I shared some reference with you, therefore how can you fetch the data.
      However, to display the exact data, you have to use our function and add your own code.

      Are you comfortable with coding or do you have any developers?

    • #92465
      itunes_schreiber
      Participant

      Hi Moumita,

      thanks for the reply.
      It’s quite not possible for me without an example to do this.
      I can code a little bit, but I have no experience regarding php,so I’m struggling here a litte bit.

      Can you may give me some further details here or provide an example?
      Then I can try to handle it.

      Regards,
      Lukas

    • #92544
      WCMp Admin
      Keymaster

      Lukas, override the email-order-details.php template and add this code on after line no 76 :

      global $WCMp;
                 $order_id=$order->get_id();
                 $suborder = get_wcmp_suborders( $order_id );
                    foreach ($suborder as $value) {
                        $suborder_id = $value->get_id();
      
                         $vendor_id = get_post_field('post_author', $suborder_id);
                       
                         $vendor_name = metadata_exists('user',$vendor_id,'_vendor_page_title')?get_usermeta($vendor_id,'_vendor_page_title',true):'';
                        $commission_id = metadata_exists( 'post',  $suborder_id, '_commission_id' )?get_post_meta( $suborder_id , '_commission_id', true ):0;
                         $commission_total = metadata_exists( 'post', $commission_id, '_commission_total' )?get_post_meta( $commission_id , '_commission_total', true ):0;
                         ?>
                         <tr>
                             <th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align )?>">Shop name: <?php echo $vendor_name; ?></th>
                             <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>"><?php echo wc_price($commission_total);?></td>
                         </tr>
                         <?php
                     }
      Copy
    • #92549
      itunes_schreiber
      Participant

      This is working perfectly.
      Thank you very much, I appreciate your support

      You can mark this as resolved.

      Regards.

    • #92567

      We are happy to help @itunes_schreiber

      I hope you are satisfied with our assistance and plugin. A 5/5 review here- https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post , would be a great way to share your experience with others.

    • #92603
      itunes_schreiber
      Participant
      This reply has been marked as private.
    • #92606
      This reply has been marked as private.
Viewing 9 reply threads

Please LOGIN to reply to this topic

COVID-19 Outbreak: WCMp team is supporting business affected by coronavirus

Read the Message Buy at Slashed Price