Woocommerce order meta data does not contain Paypal fees when order status goes to processing.

jdhutton
Contributor
Contributor

I am using the standard version.
I have an issue that I cannot figure out how to solve.

Here is the scenario.
I am using Woocommerce. Once my product is purchased and paid for, I'm trying to find the PayPal "fee" deduction attribute of a payment submitted from the meta data.

Here is my setup.

I use the add_action payment complete hook woocommerce_order_status_processing that is called if the status of the order is processing In this function I set the order status to completed.
I have add_action payment complete hook woocommerce_order_status_completed that is called when the status of the order is completed.
In this function, I read the order using the order id to get all the order information that I require
including the meta data that houses paypal fees.

Here is my problem. When I read the meta data for the order, it DOES NOT contain the paypal fees.

If I change the add_action woocommerce_order_status_processing to add_action woocommerce_thankyou, and do the exact same code, when I call add_action woocommerce_order_status_completed and I read the order to get all the information that I need to put into and output file including the meta data for paypal fees, the meta data DOES contain the paypal fees.

I really do not want to have to use the add_action woocommerce_thankyou as a solution since if a order is on-hold for a few days then clears, ( order status goes from on-hold to processing), the add_action woocommerce_thankyou does not get called and I will have to manually go into WooCommerce and set the status to completed hence calling add_action woocommerce_order_status_completed .

Do you know of a hook to call when the order has been paid for AND the meta data that contains the paypal fees is present?

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.