[Skip to main content](#vessel-content)

#   checkout complete event

##

- **[twscott](/forum/user/43011-twscott "View twscott's Profile")**
- [![twscott's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/beer.png)](/forum/user/43011-twscott "View twscott's Profile") Topic Author
- [ Offline](/forum/user/43011-twscott)

Less More

- Posts: 252
- Thank you received: 1
-
-
-
-

10 years 2 months ago [\#249515](#249515) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#249515 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")* was created by *[twscott](/forum/user/43011-twscott "View twscott's Profile")*

-- HikaShop version -- : HikaShop Business 2.6.3
-- Joomla version -- : 3.5
-- PHP version -- : 5.5.12

Hi,
I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?

Best regards
Scott

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 2 months ago [\#249532](#249532) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#249532 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi,

You should use the trigger "onAfterOrderCreate".
[ www.hikashop.com/support/documentation/6...mentation.html#order](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#order)

The checkout step trigger is related to the custom blocks that you can put in your checkout (like it is done in user points, hikamarket terms &amp; condition, etc).

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [twscott](/forum/user/43011-twscott "View twscott's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[twscott](/forum/user/43011-twscott "View twscott's Profile")**
- [![twscott's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/beer.png)](/forum/user/43011-twscott "View twscott's Profile") Topic Author
- [ Offline](/forum/user/43011-twscott)

Less More

- Posts: 252
- Thank you received: 1
-
-
-
-

10 years 2 months ago -  10 years 2 months ago [\#249727](#249727) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  Replied by *[twscott](/forum/user/43011-twscott "View twscott's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#249727 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi Jerome,
Thanks for the direction, it's very helpful.
I now am dealing with the update order process, so I need to get old order content so I can complete the update of my remote system. Could you show me how to get the old order object?

My 2ed question is, in onAfterOrderDelete($elements), is the "elements" the id of the deleted order or the deleted product ids in the order?
Thanks in advance

Best regards
Scott

Last edit: 10 years 2 months ago by [twscott](/forum/user/43011-twscott "View twscott's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 2 months ago [\#249731](#249731) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#249731 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi,

The old order object ?
In the onAfterOrderCreate trigger, there is no such object since the order has just been created. The only order object is the one given to the function.
In the onAfterOrderUpdate trigger on the other end, you do have an old order object that you can access in $order-&gt;old. Is that what you're talking about ?

In onAfterOrderDelete, $elements is an array of order ids.

The following user(s) said Thank You: [twscott](/forum/user/43011-twscott "View twscott's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[twscott](/forum/user/43011-twscott "View twscott's Profile")**
- [![twscott's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/beer.png)](/forum/user/43011-twscott "View twscott's Profile") Topic Author
- [ Offline](/forum/user/43011-twscott)

Less More

- Posts: 252
- Thank you received: 1
-
-
-
-

10 years 2 months ago [\#249932](#249932) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  Replied by *[twscott](/forum/user/43011-twscott "View twscott's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#249932 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi,Nicolas,
Thanks for your answer.
I have done written the plugin for onAfterOrderCreate().
The function is to maintain our remote system for the products stocks and the product quantity in every order.
But when it comes to update and delete order, I found there seem to have some problems, I am not sure if I understand correctly.
In updating, there is no products info in $order-&gt;old objects.
in deleting, the onAfterOrderUpdate() was triggered instead of onAfterOrderDelete(),
so my plugin could not get the required informaton from these two events. where else can I find product quantity changing information? or do you have any suggestion for the issue?

Best regards
Scott

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 2 months ago [\#249933](#249933) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#249933 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi,

I don't see why onAfterOrderUpdate would be called when you delete an order.
Look at the code of the delete function in administrator/components/com_hikashop/classes/order.php and you'll see that when you delete an order it's the onAfterOrderDelete trigger which is called.
And yes, there is no product information when the order is updated since that information is not necessary usually. It's up to you to load it with a MySQL query on the hikashop_order_product table using the order_id in $order-&gt;order_id.
As a quick a dirty way, you could use the loadFullOrder function to load all the order data as presented in our sample codes:
[ www.hikashop.com/support/documentation/6...umentation.html#code](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#code)

The following user(s) said Thank You: [twscott](/forum/user/43011-twscott "View twscott's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[twscott](/forum/user/43011-twscott "View twscott's Profile")**
- [![twscott's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/beer.png)](/forum/user/43011-twscott "View twscott's Profile") Topic Author
- [ Offline](/forum/user/43011-twscott)

Less More

- Posts: 252
- Thank you received: 1
-
-
-
-

10 years 2 months ago [\#250927](#250927) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  Replied by *[twscott](/forum/user/43011-twscott "View twscott's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#250927 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi nicolas,
I've upgrade to new version and use loadFullOrder function to load the old Order.
but I got a new trouble that I put the following
function onBeforeOrderUpdate(&amp;$order,&amp;$do) {
$orderClass = hikashop_get('class.order');
$this-&gt;oldOrder = $orderClass-&gt;loadFullOrder($order-&gt;order_id, true, false);
}
but in $this-&gt;oldOrder it gets the new order data instead of old order.
Is there any wrong with the code or is there any walk around?

Best regards
Scott

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 2 months ago [\#250951](#250951) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[checkout complete event](/forum/27-checkout/886348-checkout-complete-event#250951 "-- HikaShop version -- : HikaShop Business 2.6.3 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need to write a plugin when user complete the check out and payment process, it will write out the amount to another system. So I put my code in onAfterCheckoutStep, but it seems the plugin method never been called, Did I choose the wrong event? which one should I use?  Best regards Scott")*

Hi,

It's not possible that you get the new order data with a loadFullOrder in a onBeforeOrderUpdate trigger. However, it's possible that the order product data has already been updated.
If that's what you're talking about, then it's the trigger onBeforeOrderProductsUpdate(&amp;$order, &amp;$do) that you want to implement instead.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NjM0OC1jaGVja291dC1jb21wbGV0ZS1ldmVudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.058 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
