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

#   Location of onBeforeOrderCreate Plugin

##

- **[JF](/forum/user/67343-jf "View JF's Profile")**
- [![JF's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/67343-jf "View JF's Profile") Topic Author
- [ Offline](/forum/user/67343-jf)

Less More

- Posts: 42
- Thank you received: 3
-
-

3 years 10 months ago [\#348110](#348110) by [JF](/forum/user/67343-jf "View JF's Profile")  *[Location of onBeforeOrderCreate Plugin](/forum/35-orders-management/905668-location-of-onbeforeordercreate-plugin#348110 "-- url of the page with the problem -- :   edumall.satumalaysiahosting.com/  Hi,  May I know where the is code for onBeforeOrderCreate? As I need to set the order&#95;shipping&#95;method field for order that have multivendor.  For single vendor's order, the value of order&#95;shipping&#95;method will be inserted but multivendor's order will not.  Kindly refer the attachment for reference.  Thanks.")* was created by *[JF](/forum/user/67343-jf "View JF's Profile")*

-- url of the page with the problem -- : [ edumall.satumalaysiahosting.com/](https://edumall.satumalaysiahosting.com/)

Hi,

May I know where the is code for onBeforeOrderCreate? As I need to set the order_shipping_method field for order that have multivendor.

For single vendor's order, the value of order_shipping_method will be inserted but multivendor's order will not.

Kindly refer the attachment for reference.

Thanks.

- [ ![Capture&#95;2023-01-09.PNG](/forum/attachment/56280) ](/forum/attachment/56280 "...2023-01-09.PNG") [ ](/forum/attachment/56280?download=1 "...2023-01-09.PNG")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTY2OC1sb2NhdGlvbi1vZi1vbmJlZm9yZW9yZGVyY3JlYXRlLXBsdWdpbj90bXBsPW1hcmtkb3du) 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: 86583
- Thank you received: 14324
-
-

3 years 10 months ago -  3 years 10 months ago [\#348114](#348114) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Location of onBeforeOrderCreate Plugin](/forum/35-orders-management/905668-location-of-onbeforeordercreate-plugin#348114 "-- url of the page with the problem -- :   edumall.satumalaysiahosting.com/  Hi,  May I know where the is code for onBeforeOrderCreate? As I need to set the order&#95;shipping&#95;method field for order that have multivendor.  For single vendor's order, the value of order&#95;shipping&#95;method will be inserted but multivendor's order will not.  Kindly refer the attachment for reference.  Thanks.")*

Hi,

You can indeed implement the onBeforeOrderCreate event in a custom plugin to change the value of order_shipping_method dynamically during the order creation.

To do that, you need to create your own Joomla plugin of the group "hikashop".
A joomla plugin has two files:
- a PHP file to implement ( for example changeshippingmethod.php )
- a XML file to define it (for example changeshippingmethod.xml )
And both in a zip you can install through the Joomla extensions installer screen.
Here is an example for the PHP file: Code:

&lt;?php // No direct access defined('_JEXEC') or die; class plgHikashopChangeShippingMethod extends JPlugin { public function onBeforeOrderCreate(&amp;$order, &amp;$do) { // Update the shipping method for the order $order-&gt;order_shipping_method = 'my_shipping_method'; } }

And for example the XML file: Code:

&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;extension version="3.1" type="plugin" group="hikashop" method="upgrade"&gt; &lt;name&gt;PLG_HIKASHOP_CHANGESHIPPINGMETHOD&lt;/name&gt; &lt;author&gt;Your Name&lt;/author&gt; &lt;creationDate&gt;January 2021&lt;/creationDate&gt; &lt;copyright&gt;Copyright (C) 2021 Your Name. All rights reserved.&lt;/copyright&gt; &lt;license&gt;GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html&lt;/license&gt; &lt;authorEmail&gt;your@email.com&lt;/authorEmail&gt; &lt;authorUrl&gt;https://yourwebsite.com&lt;/authorUrl&gt; &lt;version&gt;1.0.0&lt;/version&gt; &lt;description&gt;PLG_HIKASHOP_CHANGESHIPPINGMETHOD_DESC&lt;/description&gt; &lt;files&gt; &lt;filename plugin="changeshippingmethod"&gt;changeshippingmethod.php&lt;/filename&gt; &lt;/files&gt; &lt;config&gt; &lt;/config&gt; &lt;/extension&gt;

Last edit: 3 years 10 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

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

- **[JF](/forum/user/67343-jf "View JF's Profile")**
- [![JF's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/67343-jf "View JF's Profile") Topic Author
- [ Offline](/forum/user/67343-jf)

Less More

- Posts: 42
- Thank you received: 3
-
-

3 years 10 months ago [\#348154](#348154) by [JF](/forum/user/67343-jf "View JF's Profile")  Replied by *[JF](/forum/user/67343-jf "View JF's Profile")* on topic *[Location of onBeforeOrderCreate Plugin](/forum/35-orders-management/905668-location-of-onbeforeordercreate-plugin#348154 "-- url of the page with the problem -- :   edumall.satumalaysiahosting.com/  Hi,  May I know where the is code for onBeforeOrderCreate? As I need to set the order&#95;shipping&#95;method field for order that have multivendor.  For single vendor's order, the value of order&#95;shipping&#95;method will be inserted but multivendor's order will not.  Kindly refer the attachment for reference.  Thanks.")*

Thanks for your detailed reply, it saved me ![:)](/media/kunena/emoticons/3.png ":)")

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

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