2 emails triggered for suborder refunds

WCMp Core

2 emails triggered for suborder refunds Resolved

Viewing 16 reply threads
  • Author
    Posts
    • #78637
      Madalina
      Participant

      Hi,

      I came across a problem when vendors make a refund to a customer. All the refunds made for a suborder trigger 2 emails at the same time to the customer. Could you please tell me what can I do to fix this issue and have the customer receive only 1 email when the vendor offers him a refund?

      I found some custom codes provided in other posts but they were for cancelling the emails completely for suborders so they weren’t helpful in my case.

      Thanks a lot for your help

    • #78687
      susmita
      Moderator

      @ Madalina,

      Thanks for reporting us this issue.
      You can keep a track of the progress from this link – https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/153

    • #78750
      Madalina
      Participant

      Hi,

      Thanks a lot for getting back to me and looking into this problem.

      I’ve noticed another issue in regards to refunds too. When the Admin offers a refund from a Parent Order, there are 3 emails triggered to the customer: 1 for the Parent Order and 2 for the Sub-order. (these 2 are the ones I’ve mentioned above)

      In the case of Admin doing the refund in Parent Order, I think that the customer should only receive 1 email from the parent order and none from the sub-orders, as it’s confusing for him to get so many emails about the same refund with 2 different orders IDs.

      Looking forward to hearing back from you

      Thanks,

    • #78773

      @Madalina, if the parent order is refunded, then the corresponding suborder is refunded also. That is why the customer will receive an email for both parent orders and suborder.

      Now, you may stop either parent order refund mail or suborder refund mail by adding code snippets. Let me know which one do you want to stop, so we can help you out accordingly.

    • #78817
      Madalina
      Participant

      Hello,

      I don’t understand the flow that you’ve just explained. I understand that if the parent order is changed the suborder changes too, but it shouldn’t trigger the email.From the customer’s perspective why would you receive 2 emails about the same refund?

      So, if the vendor gives a refund there is an emailed triggered for the suborder and none for the parent order – which makes sense. But if the Admin gives a refund to the parent order, then the parent order and the suborder email is triggered- which is not right. For example, if a customer buys from 10 different vendors in one order and then he decides he wants to cancel the order, the Admin has to give a full refund. So the customer ends up receiving 11 emails. Do you think this is the right behavior in this situation?

      I don’t want to stop any of the emails, as I need to use both capabilities from the admin & vendor refunds. I just want them to work as they should. So, when the vendor gives a refund only 1 email is triggered to the suborder and if the Admin gives a refund from the parent order then only one email should be triggered from the parent order (even if the suborder is changing too).
      Looking forward to hearing back from you

    • #79051

      @Madalina, I have shared this requirement with our team. They will take further decisions on this.

      I will keep you posted.

    • #81348
      Madalina
      Participant

      Hi @Moumita, please could you offer a solution for this problem?

      Thanks,

    • #81437

      @Madalina, You can send the feature request directly to our developers : https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/new

      Our team will get back to you there.

    • #82756
      Madalina
      Participant

      Hi @Moumita, I would like to know if you’re willing to fix this issue as this is not a personal request, it’s a bug, and I don’t want to bury this problem on GitHub.

      Thanks,

    • #83969
      sumit singh
      Moderator

      Hi, add this code to the

      functions.php
      copy

      of the current active theme. This will stop the suborder refund mail, when the parent order is refunded.
      add_action(‘init’, ‘remove_suborder_mail_for_parent_order_mail’);

      function remove_suborder_mail_for_parent_order_mail() {
      	global $WCMp;
      	remove_action('woocommerce_order_refunded', array($WCMp->order, 'wcmp_order_refunded'), 10, 2);
      }
      copy
    • #83973
      Madalina
      Participant

      Hi @Sumit,

      Thank you for getting back to me in regards to this problem. I’ve added the code in the functions.php but I got errors on the Orders page. Please see below:

      constant ‘init’ – assumed ‘‘init’’ (this will throw an Error in a future version of PHP) in /wp-content/themes/rigid-child/functions.php on line 647

      Warning: Use of undefined constant ‘remove_suborder_mail_for_parent_order_mail’ – assumed ‘‘remove_suborder_mail_for_parent_order_mail’’ (this will throw an Error in a future version of PHP) in /wp-content/themes/rigid-child/functions.php on line 647

      Notice: yith_wcwl_products cookie cannot be set – headers already sent by /wp-content/themes/rigid-child/functions.php on line 647 in /homepages/20/d772643783/htdocs/clickandbuilds/TasteBack/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 892

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/20/d772643783/htdocs/clickandbuilds/TasteBack/wp-content/themes/rigid-child/functions.php:647) in /wp-includes/functions.php on line 5946

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/20/d772643783/htdocs/clickandbuilds/TasteBack/wp-content/themes/rigid-child/functions.php:647) in /wp-admin/includes/misc.php on line 1252

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/20/d772643783/htdocs/clickandbuilds/TasteBack/wp-content/themes/rigid-child/functions.php:647) in /wp-admin/admin-header.php on line 9

      Please could you advise how to fix this?
      Thanks,

    • #83974
      sumit singh
      Moderator

      sorry there was a syntax error, kindly update code in functions.php

      add_action('init', 'remove_suborder_mail_for_parent_order_mail');
      function remove_suborder_mail_for_parent_order_mail() {
      	global $WCMp;
      	remove_action('woocommerce_order_refunded', array($WCMp->order, 'wcmp_order_refunded'), 10, 2);
      }
      copy
    • #84346
      Madalina
      Participant

      Hello @Sumit, thanks very much for your help I tested the code and it seems to work fine now. Is there any snippet that will solve the other issue mentioned above, when the admin or vendor gives refund on a suborder to trigger only one email? As at the moment it seems that full refund and partial refund emails are triggered when a refund is made, so the customer receives 2 emails. Any help will be very much appreciated

      Thanks,

    • #84525
      sumit singh
      Moderator

      Hi, remove the above code and paste the following code in your functions.php of active theme to restrict the above queries.

      add_action('init', 'remove_suborder_mail_for_parent_order_mail');
      function remove_suborder_mail_for_parent_order_mail() {
      global $WCMp;
      remove_action('woocommerce_order_refunded', array($WCMp->order, 'wcmp_order_refunded'), 10, 2);
      remove_action('woocommerce_create_refund', array( $WCMp->order, 'wcmp_create_refund' ), 10, 2);
      }
      copy
    • #85679
      Madalina
      Participant

      Hi @Sumit, I’ve tested the code and it seems to be doing the job well. Thank you very much for your help!

    • #85769
      susmita
      Moderator

      @ Madalina, great to know that 🙂

      We are closing this thread.

      Kindly open a new thread if you face any further query.

    • #86415

      @Madalina, We have added the fix for 2 email trigger issue in our last git update: https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/152

      So, after downloading the plugin from here – https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/archive/master.zip, follow these steps :

      – Delete the installed WC Marketplace via wp-admin >> plugin
      – Unzip the GitHub plugin
      – Rename the folder as “dc-woocommerce-multi-vendor” and remove the master tag. Now, zip this folder again.
      – Install this plugin on your site.

      We will release the same in our next update also.

Viewing 16 reply threads

The topic ‘2 emails triggered for suborder refunds’ is closed to new replies.

WCMp bundle is available at a slashed price

Grab It Now