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

#   How to question: Resetting custom-fields to blank when client reorders

##

- **[nuntius](/forum/user/29512-nuntius "View nuntius's Profile")**
- [![nuntius's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar29512.jpg)](/forum/user/29512-nuntius "View nuntius's Profile") Topic Author
- [ Offline](/forum/user/29512-nuntius)
- nuntius.nl

Less More

- Posts: 62
- Thank you received: 1
-
-
-
-

9 years 4 months ago [\#273072](#273072) by [nuntius](/forum/user/29512-nuntius "View nuntius's Profile")  *[How to question: Resetting custom-fields to blank when client reorders](/forum/35-orders-management/890954-how-to-question-resetting-custom-fields-to-blank-when-client-reorders#273072 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2 -- PHP version -- : 7.0.19 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : none  Hello,  I have a webshop where I added a custom field to the items table so a vendor can store a weight-value for each item in an order.  In this thread:   www.hikashop.com/forum/orders-management...r-functionality.html  I read and understood that if you reorder, the custom fields automatically are taken over in the new to be created order. Can I let Hikashop reset these value's automatically?  I guess I would need to create a plugin with the onAfterOrderCreate trigger and there empty the values manually? Would it be sufficient to unset the particular variables or should I give them an empty (string) value, or null?  Kind regards, Teeuwis")* was created by *[nuntius](/forum/user/29512-nuntius "View nuntius's Profile")*

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.2
-- PHP version -- : 7.0.19
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : none

Hello,

I have a webshop where I added a custom field to the items table so a vendor can store a weight-value for each item in an order.

In this thread:
[ www.hikashop.com/forum/orders-management...r-functionality.html](https://www.hikashop.com/forum/orders-management/876090-question-on-reorder-functionality.html)
I read and understood that if you reorder, the custom fields automatically are taken over in the new to be created order. Can I let Hikashop reset these value's automatically?

I guess I would need to create a plugin with the onAfterOrderCreate trigger and there empty the values manually? Would it be sufficient to unset the particular variables or should I give them an empty (string) value, or null?

Kind regards,
Teeuwis

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

9 years 4 months ago [\#273084](#273084) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to question: Resetting custom-fields to blank when client reorders](/forum/35-orders-management/890954-how-to-question-resetting-custom-fields-to-blank-when-client-reorders#273084 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2 -- PHP version -- : 7.0.19 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : none  Hello,  I have a webshop where I added a custom field to the items table so a vendor can store a weight-value for each item in an order.  In this thread:   www.hikashop.com/forum/orders-management...r-functionality.html  I read and understood that if you reorder, the custom fields automatically are taken over in the new to be created order. Can I let Hikashop reset these value's automatically?  I guess I would need to create a plugin with the onAfterOrderCreate trigger and there empty the values manually? Would it be sufficient to unset the particular variables or should I give them an empty (string) value, or null?  Kind regards, Teeuwis")*

Hi,

When you click on the "reorder" button, what happens is that the products from the order are added to the cart.
So you would have to actually implement the onBeforeCartSave(&amp;$element, &amp;$do) trigger in order to remove the custom item fields values from $element-&gt;products (with an unset).
In the trigger of your plugin, you can easily know if the customer is currently reordering by having a check like that: Code:

if($_REQUEST['task']!='reorder') return;

Because with a trigger like onAfterOrderCreate, it's much more complex as you're not sure that the customer is coming from a reorder, and you have to write MySQL queries to empty the custom item fields of the products of the order.

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