Change the WooCommerce payment status for prepaid orders

change-pay-install-woocommerce-for-don-dat-shop-

Change the WooCommerce payment status for prepaid orders - Managing the WooCommerce order status is an essential activity in a store that takes up a lot of time. It is important that the entire order is updated regularly to reflect the most recent status.

Cash-on-Delivery is a very popular payment option that no WooCommerce website owner can ignore. However, there is a scenario where customers prepay for purchases to speed up the execution process. In such a case, it is likely that even if the order has been fulfilled (sent, delivered to the customer), you miss the order status update.

This is a simple WooCommerce payment status solution

You automate the process of updating order statuses for prepaid orders. The order will automatically update to Complete when the WooCommerce payment status is updated.

change-pay-install-woocommerce-for-don-dat-shop-

How it works

The code uses the WooCommerce_order_status_changed hook to call the function when the order status changes. Once the order status is verified as Processing, the payment method is NOT cash on delivery, the order status is changed to ‘Completed.

See more: Who has viewed my facebook

update_status () sets the order status passed to the method. Here is a brief list of the order status you can switch to this method:

Payment is pending

Handling

Pause

Accomplished

Cancelled

Refunds

Unsuccessful

wc_get_order () is a wrapper function that retrieves order objects that provide all data about a specific order.

Similarly, $ order retrieves order information as an object via the wc_get_order () function. You also use the following line in the above code snippet to get the total order number in the format.

At the checkout page, if you have selected the cash payment method on delivery as shown below:

Once the order has been processed, you see:

Product information ordering WooCommerce

The following code snippet will display products in order. Note that this code will be placed at the location in the sample file where you want to display information:

change-pay-install-woocommerce-for-don-dat-store-width

If you're interested in changing the status of changing WooCommerce orders based on order status, this short guide provides you with a simple solution. How to create custom WooCommerce order status.

Conclusion

Changing the status of a WooCommerce order, especially for prepaid orders, is a simple matter when adding a simple snippet of code to the WooCommerce sample file. If you need help implementing an idea, leave a comment, I'll get back to you.

About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. https://www.nguyendiep.com/. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts

Comments

Post a Comment