Support » Plugin: WC Vendors Marketplace - The WooCommerce Multivendor Marketplace Solution » Vendor notify email – Payment status

  • Resolved brennsuppa

    (@brennsuppa)


    Hi,

    on our test stage we encounter a problem with the payment status. When a customer buys a virtual booking product, we added a code snippet to autocomplete the order from “processing” to “completed”. After that, the customer receives an e-mail that has the payment status “paid”. At the same time, the vendor gets the new customer order e-mail with the same data, but the payment status is “unpaid”.

    If the admin enters the booking in the woocommerce backend and sends the vendor notify e-mail manually without editing anything, the payment status is “paid”.

    It seems to me that the vendor notify e-mail is fired too soon, therefore I altered the priority of the autocomplete without success.

    How can we solve this?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Support Mark Kevin

    (@mkesteban08)

    Hi Bren,

    Could you send us a snippet of your code on how you are doing this from your end? We might be able to help you on how to fix the priority of how you made the autocomplete.

    I’ll look forward to your reply to check this.

    Thread Starter brennsuppa

    (@brennsuppa)

    Hi Mark,

    we are using this snippet in our functions.php

    add_action( 'woocommerce_payment_complete_order_status', 'wc_auto_complete_paid_order', 1, 3 );
    function wc_auto_complete_paid_order( $status, $order_id, $order ) {
        return 'completed';
    }

    Thank you

    Plugin Support junenacpil29

    (@junenacpil29)

    Hello @brennsuppa ,

    I have asked inputs from our development team to see if this is possible however we cannot guarantee a solution at the moment.

    Speak soon!

    Plugin Support junenacpil29

    (@junenacpil29)

    Hello @brennsuppa ,

    Our developer took a look at your code and mentioned the changes that you can do:
    First off, this is a filter not an action hook
    woocommerce_payment_complete_order_status.

    So instead of using add_action you must change to add_filter and if you want to change the status if only it is processing to completed then you should wrap the return in a conditional statement like so:

    add_filter( 'woocommerce_payment_complete_order_status', 'wc_auto_complete_paid_order', 1, 3 );
    function wc_auto_complete_paid_order( $status, $order_id, $order ) {
    	if ( 'processing' == $status ) {
    		return 'completed';
    	}
    	return $status;
    }

    We would also recommend, that you change the priority, 1 might be too early it may be overwritten by other filters.

    Please do let us know if this works for you.

    Thread Starter brennsuppa

    (@brennsuppa)

    Hi @junenacpil29

    thank you for your response, unfortunately this did not change the behaviour.
    I tried different priorities and also some other snippets with the same outcome.

    Plugin Support Mark Kevin

    (@mkesteban08)

    Hi Brenn,

    I’ll double-check with our developers if we could proceed in editing how the emails are sent or if it could be overridden by changing the priorities.

    I’ll get back to you as soon as I have more information about it.

    Thread Starter brennsuppa

    (@brennsuppa)

    Hi Mark,

    is it possible to simply hide this payment status in the vendor e-mails? Since we only accept full payments and thus none of them are unpaid we could loose this line, if that is easier to achieve.

    Plugin Support Mark Kevin

    (@mkesteban08)

    Hi Brenn,

    Apologies as we still don’t have the solution for your preference at this moment, but I went ahead and followed it up to our developers ,I asked if there could be a reason on why the status is triggering the email when it should not.

    If you would like to hide the it within the email, you can simply edit the email template and delete that specific part from the email template.

    Thread Starter brennsuppa

    (@brennsuppa)

    Hi Mark,

    thanks for the update. I cannot find the payment status within the email templates and the meta data in the database don’t have a payment status, so hiding it is rather tricky as well.

    Plugin Support Mark Kevin

    (@mkesteban08)

    Hello Brenn,

    Yes, pretty much, this is tricky as we we’ll need to remove or hide it from the table directly. I’ve asked our developers if we can provide you a filter for such and I’ll be sure to get back to you as soon as I have more information about it.

    Additionally about the code above, please take note that the email is triggered for the vendor is because it is hooked to woocommerce_payment_complete_order_status which runs when the payment is complete.

    So, the code above does not trigger the email, the email is triggered when the user completes payment, then the above code runs to change the order status from processing to complete, going back and making the email gets triggered.

    The code above only changes the status from processing to complete. As our developer mentioned, by the time the code above is executed, the email was already triggered because the code is hooked to change order status after payment was completed.

    Thread Starter brennsuppa

    (@brennsuppa)

    Thank you Mark,

    am I the only one with this dilemma?

    Plugin Support Mark Kevin

    (@mkesteban08)

    You’re always welcome Brenn!

    As of now, yes, you’re currently the only one who would like to have this customized 🙂

    Have a nice day ahead!

    Plugin Author Jamie

    (@digitalchild)

    Hi @brennsuppa

    I would suggest attempting to find another hook earlier to change the status as we haven’t seen anyone else with this issue at this stage.

    cheers,

    Jamie.

    Thread Starter brennsuppa

    (@brennsuppa)

    Hi Mark and Jamie,

    I tried a lot with different hooks without success. Trying to step back a little I’d like to know about the payment status change.

    As you wrote Mark: “the code above does not trigger the email, the email is triggered when the user completes payment”

    Now how can the payment state in the vendor e-mail be unpaid if it is triggered after a complete payment?

    Plugin Support junenacpil29

    (@junenacpil29)

    Hello Brenn,

    I have relayed your inquiry to our development team and we’ll make sure to get back to you as soon as we can.

Viewing 15 replies - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.