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

#   Trigger from when order status was changed to shipped

##

- **[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
-
-
-
-

9 years 11 months ago [\#255812](#255812) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  *[Trigger from when order status was changed to shipped](/forum/31-development/887581-trigger-from-when-order-status-was-changed-to-shipped#255812 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need a trigger when order status was changed to shipped, but in the document there seems no such an Order API. How could I do this? Thanks in advance.  Best Regards")* was created by *[twscott](/forum/user/43011-twscott "View twscott's Profile")*

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.5
-- PHP version -- : 5.5.12

Hi,
I need a trigger when order status was changed to shipped, but in the document there seems no such an Order API. How could I do this? Thanks in advance.

Best Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NzU4MS10cmlnZ2VyLWZyb20td2hlbi1vcmRlci1zdGF0dXMtd2FzLWNoYW5nZWQtdG8tc2hpcHBlZD90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 11 months ago [\#255817](#255817) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Trigger from when order status was changed to shipped](/forum/31-development/887581-trigger-from-when-order-status-was-changed-to-shipped#255817 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need a trigger when order status was changed to shipped, but in the document there seems no such an Order API. How could I do this? Thanks in advance.  Best Regards")*

Hi,

There is. You can use the "onAfterOrderUpdate" trigger.
In it you need to check that $order-&gt;order_status is equal to "shipped" and that $order-&gt;old-&gt;order_status is set to "confirmed" so that you know that the status of the order has just been changes from confirmed to shipped.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NzU4MS10cmlnZ2VyLWZyb20td2hlbi1vcmRlci1zdGF0dXMtd2FzLWNoYW5nZWQtdG8tc2hpcHBlZD90bXBsPW1hcmtkb3du) 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
-
-
-
-

9 years 11 months ago [\#255882](#255882) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  Replied by *[twscott](/forum/user/43011-twscott "View twscott's Profile")* on topic *[Trigger from when order status was changed to shipped](/forum/31-development/887581-trigger-from-when-order-status-was-changed-to-shipped#255882 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need a trigger when order status was changed to shipped, but in the document there seems no such an Order API. How could I do this? Thanks in advance.  Best Regards")*

Thanks, Nicolas. I works.
But I found when I update the order status, the function was triggered 3 time. Is there ways to make it call only once?

Best regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NzU4MS10cmlnZ2VyLWZyb20td2hlbi1vcmRlci1zdGF0dXMtd2FzLWNoYW5nZWQtdG8tc2hpcHBlZD90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 11 months ago [\#255896](#255896) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Trigger from when order status was changed to shipped](/forum/31-development/887581-trigger-from-when-order-status-was-changed-to-shipped#255896 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.5 -- PHP version -- : 5.5.12  Hi, I need a trigger when order status was changed to shipped, but in the document there seems no such an Order API. How could I do this? Thanks in advance.  Best Regards")*

Hi,

It is called only once per order and per save.
If you have HikaMarket and you change the status of an order, you'll also have each sub order's status changed and thus, the trigger will also be called for each sub sale.
So in that case, you probably only want to take into account the save of main orders and thus add a check on $order-&gt;order_type (or $order-&gt;old-&gt;order_type) equal to "sale" in your code.
Mass actions or third party plugins (or even some particular HikaShop plugins) can also potentially save orders to change something after an order is saved. Deactivating them can help avoid that, but if you have them, it's probably that you use them, so it's better to add additional checks in your plugin in such cases.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NzU4MS10cmlnZ2VyLWZyb20td2hlbi1vcmRlci1zdGF0dXMtd2FzLWNoYW5nZWQtdG8tc2hpcHBlZD90bXBsPW1hcmtkb3du) 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.047 seconds

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