How to know order completed on WooCommerce

January 17, 2021
How to know order completed on WooCommerce

Recently, one of my customers wanted to automatically mark an order on WordPress as completed one day after the order.

As you may know, cron-job process in WordPress does not working like cron-jobs in PHP. If you have low amount of visitors, the first visit triggers it. Additionally, some cache plugins may prevent this but our topic is not directly related with this.

In WordPress, you can trigger any function that you want to run by adding “woocommerce_thankyou” action when an order is completed. Well, is this the best solution?

WooCommerce Thank You Page Problem Scenarios

Some payment gateways open a thank you page, place a button on this page and open the payment page as a new page or in pop-up. For example, Redsys. Then, when payment is received, they show a “payment successful” page. On bottom-right part of the page, a small button exists and if your customer doesn’t click on it, your function will not work.

It is the same on Paypal. During payment process with Paypal, if the user closes the page right after he/she completes payment, the page is not displayed.

Cash on Delivery and Money Orders

With cash on delivery and money orders, on the other hand, you can trust woocommerce_thankyou page.

add_action( 'woocommerce_thankyou','wf_recieve_order', 10, 1 );

Payment Gateways With Instant Payments

For Paypal and some credit card payment gateways, we will use payment completed hook. This way, no matter what happens, our function will run if payment is completed.

add_action( 'woocommerce_payment_complete','wf_recieve_order', 10, 2 );

It is really necessary to be careful about delicate matters like payment, otherwise you may encounter serious problems.

Tags

What do you think?

What do you think?

59 Comments:
August 25, 2024

If you click you will be surprised!

August 25, 2024

Just Click And Give Correct Answer To Get Your Free Gift Card

September 24, 2024

2009 Sep 22; 54 13 1189 dapoxetina generico

October 24, 2024

online courses with qualifications

October 31, 2024

This internet site is my inhalation, very superb design and perfect content material.

November 9, 2024

Dehydration is the primary issue if you re not able to pee after taking Lasix because an increasing frequency of pee is expected after taking it generic priligy

November 16, 2024

I’ve been surfing on-line more than 3 hours nowadays, but I by no means discovered any fascinating article like yours. It’s lovely price sufficient for me. Personally, if all webmasters and bloggers made excellent content as you did, the web can be much more useful than ever before. “Baseball is 90 percent mental. The other half is physical.” by Lawrence Peter Berra.

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

November 27, 2024

the best in this business thank you,journalsoa

November 28, 2024

the best in this business thank you,emedicalcentral

November 28, 2024

the best in this business thank you,journalsoa

November 28, 2024

the best in this business thank you,clinicalmedicaljournals

November 28, 2024

the best in this business thank you,medicalres

December 3, 2024

experience and quality thank you.fourtech

December 3, 2024

experience and quality thank you.francobenvenutiartista

December 3, 2024

experience and quality thank you.tendertoo

December 6, 2024

the best in this business thank you,liusaari

December 6, 2024

the best in this business thank you,maketeamstudiot

December 6, 2024

the best in this business thank you,masmoudi

December 8, 2024

experience and quality thank you.itcimpianti

December 8, 2024

experience and quality thank you.hotelprincipessalucca

December 12, 2024

experience and quality thank you.doubleclick

December 12, 2024

experience and quality thank you.klfgoteborg

December 12, 2024

experience and quality thank you.edm-nivelles

December 16, 2024

the best in this business thank you,jayteeinsurance

December 16, 2024

the best in this business thank you,jeromeandleighcrutch

December 17, 2024

the best in this business thank you,jerryshulmanproduceshipper

December 17, 2024

the best in this business thank you,jerryspridepotatoes

December 18, 2024

the best in this business thank you,jerryshulmanproduce

December 18, 2024

the best in this business thank you,juventuspizza

December 18, 2024

the best in this business thank you,jvidesigns

December 20, 2024

the best in this business thank you,konarprecision

December 20, 2024

the best in this business thank you,justmyvoice

December 20, 2024

the best in this business thank you,leoemma

December 20, 2024

experience and quality thank you.emperorsoft

December 20, 2024

experience and quality thank you.live-now

December 20, 2024

experience and quality thank you.saafa

December 21, 2024

the best in this business thank you,leonfukspc

December 21, 2024

the best in this business thank you,ligbtour

December 21, 2024

the best in this business thank you,lioutdoorliving

December 21, 2024

the best in this business thank you,liontrading

December 23, 2024

the best in this business thank you,lewisy

December 23, 2024

the best in this business thank you,lckcabinetry

December 23, 2024

the best in this business thank you,longislandcocktailhours

December 24, 2024

the best in this business thank you,lordshoes

December 24, 2024

the best in this business thank you,louisbarbatolandscaping

December 24, 2024

the best in this business thank you,luisrestorations

December 24, 2024

the best in this business thank you,lorlin

December 24, 2024

experience and quality thank you.huisjacobs

December 25, 2024

the best in this business thank you,icredit

December 25, 2024

the best in this business thank you,rands

December 25, 2024

the best in this business thank you,thewindowmill

December 25, 2024

the best in this business thank you,touchofclasscoll

December 25, 2024

the best in this business thank you,unityrubbercompany

December 25, 2024

Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

December 26, 2024

the best in this business thank you,brcanvas

January 7, 2025

Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

January 15, 2025

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

February 17, 2025

Your point of view caught my eye and was very interesting. Thanks. I have a question for you.

Leave a Reply

Your email address will not be published. Required fields are marked *

More notes