Failed Order Email Vendor

WCMp Core

Failed Order Email Vendor Open

Viewing 36 reply threads
  • Author
    Posts
    • #78789
      serdarO-3
      Participant

      Hello,

      Why wc marketplace sending new order mail to vendors for failed and pending orders ?
      What is reason ? I couldn’t find any logical reason.

      And how can I send email for only proccessing orders?
      And how can prevent commission calculate before proccessing.

    • #78791

      @serdarO-3, nice to hear from you.
      I have sent the request to our dev team, I will be able to give you an update by Monday. As we are closed due to the weekend.

    • #88071
      Ash
      Participant

      Hello,

      Any update on this? I have just experienced this also. Our vendors were a little confused and so was I. The most confusing thing is that the failed order number is not in the database at all, anywhere. So when searching for this order number, it doesn’t exist anywhere apart from in the new order email the vendor received. Very confusing.

      Is there any fix for this?

    • #88076

      Hi @Ash, every vendor order must have its corresponding parent order.

      Now, it may happen, that the order status of the parent order is changed. But, only the initial order status of the parent order is synced with the suborder.

      So, if the parent order is changed from failed to something else, this will not change the suborder status.

      To help you out better, can you share a temporary admin and vendor access in another thread, so I can check that.

    • #88141
      Ash
      Participant

      Hello, thank you for the reply.

      I understand the relationship between order and suborders now, thank you.

      The issue I’m really having is that the vendor gets a new order email when an order fails. Then if the customer try’s again and is successful, the failed suborder disappears and replaced with the successful order, that is good and to be expected. But the first email the vendor got is now meaningless.

      So, to solve the issue, I believe the vendor order email should only be sent once the main order is complete with the attached suborder. Else you could get the issue above.

      Does that make sense? I can’t share admin access to my site as the company I work for will not allow shared access due to security.

      To sum, this is what is happening:

      1. Customer adds product to their basket and proceeds to checkout.
      2. Customer payment fails for some reason. Incorrect billing address for example.
      3. WCMP sends the vendor a new order email – This should not be sent.
      4. Customer corrects their billing information and successfully completes the checkout process.
      5. WCMP sends another new order email to the vendor.

      Step 3 is the problem, there should be a check to ensure that the checkout process is actually complete and only send emails once it is.

    • #88146

      Hi @Ash, in order to stop the failed order mail, please do use this code in the function.php of the current active theme :

      function restrict_vendor_new_order_mail( $recipient, $order ) {
         if( $order->get_status() == 'failed' ) {
      return;
      } else {
      return $recipient;
      }
      }
      add_filter('woocommerce_email_recipient_vendor_new_order', 'restrict_vendor_new_order_mail', 1, 2);
      Copy
    • #88153
      Ash
      Participant

      This doesn’t 100% solve the problem.

      Yes, it does stop the failed order email coming, but if the user then corrects their information and successfully completes the order at the second attempt, the vendor does not get a new order email.

    • #88218

      @Ash, when customer places an order, the corresponding suborder also gets created along with the vendor mail, even for pending payment.
      Our system sends the vendor the email for the initial order only.

      So, now when the site is updating the parent order’s status, you need to send the Vendor New order mail again. So, let us know, for which order status you want the vendor’s new order to be triggered.

    • #88252
      Ash
      Participant

      Thanks for the reply.

      It just needs to be sent when the order status is complete.

      The code above does the first step of stopping the vendor new order email if the order is failed. Now it just needs to recheck or only send once the suborder is complete.

    • #89584
      sumit singh
      Moderator

      Hi @Ash, add the following codes in functions.php of your active theme :-

      function restrict_vendor_new_order_mail( $recipient, $order ) {
         if( $order->get_status() == 'completed' ) {
      return $recipient;
      } else {
      return;
      }
      }
      add_filter('woocommerce_email_recipient_vendor_new_order', 'restrict_vendor_new_order_mail', 1, 2);
      Copy
    • #89618
      Ash
      Participant

      Hi,

      this is the same function as posted above. It doesn’t solve the problem.

      It stops the vendor from getting the new order email, great. But then if the same order is completed successfully the email is not sent to he vendor. As explained above.

    • #98834
      serdarO-3
      Participant

      Hi @Ash did you solve this problem ?
      I couldn’t solve problem. Vendors still gets email for failed orders 🙁 And it’s a big problem.

    • #98837
      Ash
      Participant

      Unfortunately I didn’t. My platform uses a closed group of users so I explained the issue and then with the COVID outbreak we have had to close the marketplace until further notice anyway.

      If you find a solution I would be very interested in hearing it please.

    • #98838
      serdarO-3
      Participant

      Of course I will. I will work on it. This is becoming a big problem. Some of our vendors shipped directly when they got “new order email”. And we paid their money for failed orders. It is a very amateurish mistake.

    • #98839
      Ash
      Participant

      I agree, it also caused me issues. It is a fundamental flaw in the flow, one I have tried to explain to the team but they don’t seem to fully understand the issue.

      The frustrating thing is it’s very easy to test for. Simply use the Stripe test cards across multiple situations and the problems are clear to see.

    • #98846
      chris sands
      Participant

      I have also noticed this when testing our site. If Stripe throws an error, the checkout page shows the error rather than a ‘success’ message.. meaning no order should be created.

      However the vendor gets an email confirmation, but no order appears in their Dashboard, like a phantom order that they might start preparing!

    • #98848
      chris sands
      Participant

      Ah OK, I was getting a Stripe error because my site was still in Stripe debug mode, when I disable this, no error is shown and emails are OK to go out.

      My error was like this:
      “Error creating charge record with Stripe: The source you provided has already been attached to a customer.”

      So this is actually nothing to worry about and this order should go through OK?

    • #98849
      chris sands
      Participant

      Sorry no, I am still getting this Stripe error (even when not in debug mode), I have added the @moumita code to my functions.php but the email still goes out to the Vendor. Also the order email goes to the Customer. But the order doesn’t exist in Woocommerce! How is this possible? This is quite a big problem.

    • #98863
      sumit singh
      Moderator

      Hi, We trigger vendor new order email for two possibility. I have reviewed our code and found there are status checking issue for one possibility.
      I have tried with paypal and stripe to craete failed order but unfortunatelty it doesn’t work.
      So it will be very helpfull from you, if you guide me how to create failed order with test accounts after checkout.

      thankyou.

    • #98864
      serdarO-3
      Participant

      Hi sumit,
      Fill the checkout boxes(adress, phone bla bla ) then go to payment screen (order will be created as “pending payment”) then leave the payment screen. If you don’t complete order payment and leave, order status will be updated to “failed” from “pending payment” after 30min. And then you can see new order email in vendor mail inbox

    • #98865
      Ash
      Participant

      Hi,

      To make the payment fail ensure Stripe is turned to demo mode in the backend of WooCommerce. Then go through the checkout as you would and when you get to card number use the number: 4000000000000036 with any expiry date and verification code and the order will fail. If at that stage you check the back end orders you will see the failed order.

      Stripe offer a vast number of test card numbers. Please see here Stripe Test Cards

    • #98867
      serdarO-3
      Participant

      Basically if order status changes from “pending-payment” to “failed” vendor gets a new order mail.
      For quick demo. Change status of an existing order(and suborder) to “pending payment” then change parent order status to “failed” from admin panel. You will see vendor will receive a new order email

    • #98883
      serdarO-3
      Participant

      One more information :
      Customer can return and can pay failed order later. So vendor should get email when customer pay it.

    • #98999
      serdarO-3
      Participant

      Could you check it ? @sumit

    • #99374

      @serdarO-3, Our team will get back to you on by end of the day.

      we will keep you posted.

    • #99469
      sumit singh
      Moderator

      Hi, I have tried with the process you have shared above to failed the order but i am unable to recreate this issue at hour end.
      It will be better if you share your staging site access with us where we can able to recreate the issue and debug.

      Thank you.

    • #99545
      serdarO-3
      Participant

      Hi,
      Can you create a vendor which you will be able to get new order mails in your demo page. I will create a failed order from admin demo. Is it ok ?

    • #99582
      sumit singh
      Moderator
      This reply has been marked as private.
    • #99611
      serdarO-3
      Participant
    • #99608
      serdarO-3
      Participant

      Hello again.

      I tried to create issue and saved screen as a video.
      You can watch : https://drive.google.com/file/d/1u8UeMMmWSPSBUqG0Z9Xdw9OcLh_rylee/view

      What did I do ?
      I tried to buy a product of test_vendor. I left on paypal login screen. Order status was “Pending Payment”
      then I logged as admin and change order status to “Failed”. Why did I do it ? Because Payment Systems can make it as failed if payment fails. My payment system waits for 30 min. Then changes order status as faled. I don’t know what PayPal does. Maybe it updates status as cancelled. But I had’nt time to wait. So I manually updated it as failed. As you see if a order status switches from pending payment to failed wcmp send a new order email.
      You can try as my video.
      I changed vendor email as yours again. I hope it’s ok.
      Thanks and regards

    • #99609
      serdarO-3
      Participant

      Hello again Sumit

      I tried to create issue and saved screen as a video.
      You can watch : https://drive.google.com/file/d/1u8UeMMmWSPSBUqG0Z9Xdw9OcLh_rylee/view

      What did I do ?
      I tried to buy a product of test_vendor. I left on paypal login screen. Order status was “Pending Payment”
      then I logged as admin and change order status to “Failed”. Why did I do it ? Because Payment Systems can make it as failed if payment fails. My payment system waits for 30 min. Then changes order status as faled. I don’t know what PayPal does. Maybe it updates status as cancelled. But I had’nt time to wait. So I manually updated it as failed. As you see if a order status switches from pending payment to failed wcmp send a new order email.
      You can try as my video.
      I changed vendor email as yours again. I hope it’s ok.
      Thanks and regards

    • #99670
      sumit singh
      Moderator

      Hi, if admin changes the order status manually then WooCommerce sends a mail to the customer only.
      Neither admin or vendor (as per our current flow) will get any email regarding the order status. So I am not sure how are the vendors are getting failed order mail on your site, when you are chnaging the order status.

      To check this, you can add a vendor on our end using your mail.
      Or it will be really better if you can share a staging site with us, and we can debug this on your end, as you are facing this error.

    • #99681
      serdarO-3
      Participant

      Hi,
      Did you watch video ? I think you didn’t really.
      1- I updated vendor email to mine. So vendor gets email and I got email. Please watch again.
      2- You should create an order as a customer and try to payment via paypal and leave from paypal screen and then you can try to change order status from pending payment to failed from admin side.
      3- As I said if payment system doesn’t update order status for failed payments it doesn’t send email. But as my online payment system some payment systems waits for a few minute and if payment fails, it updates order status as failed.
      And please check your spam mail junk box

      Please watch carefully : https://drive.google.com/file/d/1u8UeMMmWSPSBUqG0Z9Xdw9OcLh_rylee/view

      I hope you will watch carefully again. I did it in your demo page. But still you say you dont get email.

    • #99689
      Ash
      Participant

      I can also confirm that the vendor definitely does get the failed order email as it’s a problem I am still having to this day.

      I don’t understand how it is so hard to test for this situation. Above there is a video explaining how to replicate the issue with paypal and I have stated many times above how to do it with Stripe in test mode with their card test numbers. It is very easy to replicate.

    • #99775
      sumit singh
      Moderator

      Hi @serdarO-3, Thankyou for the video.
      I have checked the whole process and i have found the solution. Kindly follow the steps :
      Add the following code in wcmp/Classes/class-wcmp-calculate-commissions.php

      search ‘ ), $order_id, $from_status, $to_status ) ) ) ‘ (I am assuming on line no : 74) and replace with the following line :

      ), $order_id, $from_status, $to_status ) ) || $to_status == 'failed')
      Copy

      Let us know about the updates and we will add this in our next update.

    • #99782
      serdarO-3
      Participant

      Thanks,
      I will try but if we change directly from classes what will happen when we update plugin ?

    • #99828

      @serdarO-3, We will add this fix on our next update. You can check the progress of this issue from here : https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/390

      So, for now, you can edit the code, not an issue.

Viewing 36 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