Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

Remove product price from vendor-new-order emails

WCMp Core

Resolved
Viewing 8 reply threads
  • Author
    Posts
    • #122645
      raoul
      Participant

      My vendor-new-order emails currently show Product, Quantity and Price columns. I would like the automated vendor-new-order email to only include the Product name and the quantity. I would also like to remove the ‘Subtotal’ and ‘Total’ fields at the bottom.

      This is because I offer discounts to my customers but still pay the vendors the full amounts. Currently the price shown to the vendor is the discounted price and vendors assume I am not paying them the full amount. For this reason I simply want to display the list of products that have been ordered and the quantity of each product. If there is a code snippet that can do this that would be amazing!

      Thanks

    • #122716

      Hi raoul, thanks for your query.

      As you want to remove some fields from vendor new order mail. So for this, you have to override the vendor-new-order.php template.
      In order to override vendor-new-order.php, copy it to yourtheme/dc-product-vendor/emails/vendor-new-order.php

      This link is the code of our template : https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/blob/master/templates/emails/vendor-new-order.php

    • #122719
      raoul
      Participant

      Hi there,

      Thanks for the reply. Actually, I have already copied the template and overriden it for my vendor email as I have some custom copy at the top.

      I am hoping to understand how I can specifically remove the price column as shown in my screenshot. Can I just remove the sections relevant to price? i.e. if I remove the if loop ‘if (apply_filters(‘show_cust_order_calulations_field’, true, $vendor->id))’ and I remove the column heading ‘<th scope=”col” style=”text-align:<?php echo $text_align; ?>; border: 1px solid #eee;”><?php _e(‘Commission’, ‘dc-woocommerce-multi-vendor’); ?></th>’ > will that remove all cost information from the email?

      Thanks

    • #122814

      Hi,
      Vendor new order mail has no price label. There is a commission filed. attached. So, are you referring to this template or another?

    • #122821
      raoul
      Participant

      Apologies, I mean the commission column, not price (reason I said price is because I changed the label from ‘commission’ to ‘price).

      So to confirm my request I would like to remove:
      1) the ‘commission’ column as shown in your screenshot
      2) ‘Subtotal’, ‘Shipping subtotal’ and ‘Total’ from the bottom of the email

      Thanks

    • #122855

      Hi,
      Remove all your custom code and just follow my instruction —
      1. Use this below code in your currently active theme functions.php file to remove shipping subtotal and total

      add_filter('wcmp_vendor_get_order_item_totals', function($order_item_totals, $order, $vendor) {
          unset($order_item_totals['shipping_subtotal'], $order_item_totals['total']);
          return $order_item_totals;
      }, 10, 3);
      Copy

      2. override vendor-new-order.php this template in your theme/ plugin
      2.a. remove line no 28
      2.b. replace line no 34 ( $vendor->vendor_order_item_table … ) with this below code

      $vendor_items = $order->get_items( 'line_item' );
      foreach ($vendor_items as $item_id => $item) {
      $product = $item->get_product();
      $_product = apply_filters('wcmp_woocommerce_order_item_product', $product, $item);
      ?>
      <tr class="">
          <td scope="col" style="text-align:left; border: 1px solid #eee;" class="product-name">
              <?php
              if ($_product && !$_product->is_visible()) {
                  echo apply_filters('wcmp_woocommerce_order_item_name', $item->get_name(), $item);
              } else {
                  echo apply_filters('woocommerce_order_item_name', sprintf('<a href="%s">%s</a>', get_permalink($item->get_product_id()), $item->get_name()), $item);
              }
              wc_display_item_meta($item);
              ?>
          </td>
          <td scope="col" style="text-align:left; border: 1px solid #eee;">   
              <?php
              echo $item->get_quantity();
              ?>
          </td>
      </tr>
      <?php
      }
      Copy

      Enjoy 🙂
      Thanks

    • #125751
      raoul
      Participant

      Hey, thanks so much for the code, it almost all works.

      The only bit I can still see is the ‘subtotal’ of the order. I put in the below code but the subtotal is still showing on the email. Am I doing something wrong?

      add_filter(‘wcmp_vendor_get_order_item_totals’, function($order_item_totals, $order, $vendor) {
      unset($order_item_totals[‘shipping_subtotal’], $order_item_totals[‘total’], $order_item_totals[‘subtotal’]);
      return $order_item_totals;
      }, 10, 3);

    • #125754

      Hello @Raoul , hope you are doing well.
      We have forwarded this to our developer . Kindly provide them some time. They will help you out .

    • #125792

      Hi,
      WCMp New order mail has ‘Commission Subtotal’, ‘Tax Subtotal’ and ‘Shipping Subtotal’.

      Checkout the below image –

      To remove Commission Subtotal use –

      $order_item_totals['commission_subtotal']
      Copy

      To remove Tax Subtotal use –

      $order_item_totals['tax_subtotal']
      Copy

      Regards,

Viewing 8 reply threads

The topic ‘Remove product price from vendor-new-order emails’ is closed to new replies.