Jump to content

Hook on checkout button click


kizbo

Recommended Posts

Hello.

I have some additional fields in my cart that my user has to fill before going to checkout, and my question is, how can i hook into the checkout button click event?

 

I desire to pass this data from fields to PHP hook and then, add a record in database. 

 

Important thing is that i need to pass order_id to MYSQL record, is that possible on this point of ordering, or i need to pass it futher.

 

Thanks for help

Link to comment
Share on other sites

Hi,

As per my understanding, you already have extra data somewhere (eighter in the form OR cookie) on the checkout page & you want to save extra data on clicking on Place order button? If yes, you can use ActionValidateOrder hook to achieve the same.

You need to store the extra on the cookie & implemented the ActionValidateOrder hook (It will be called after order placement).

public function hookActionValidateOrder($params)
{
	$orderDetails = $params['order'];
}

 

Using the above code, you will get the order details including order ID & you can fetch the extra info from the cookie & save the data accordingly (Clear your extra info cookie in the same function).

I hope it will help.

  • 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...