Jump to content

How do I get invoice number with ActionValidateOrder?


matoola

Recommended Posts

Hi,

 

I have a module which triggers with ActionValidateOrder hook but can't seem to get invoice number even though it is generated?

 

I tried this but it's empty:

$invoice = $params['order']->invoice_number;

 

is there another way to do it?

 

 

thanks so much,

Matej

Link to comment
Share on other sites

The ActionValidateOrder hook is fired before the "Payment Accepted" status is set, and therefore the invoice_number is not available to you during this hook.

 

You would have to edit the PaymentModule class, and move the hook execution below the code that set the order status and reloads the order object.

 

You could also use a different hook "actionPaymentConfirmation", which will get triggered when the order status changes to "Payment Accepted", which typically happens during the creation of a new order.  Just keep in mind that it could also happen at other times as well, like from the back office order detail page.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...