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

#   Regular Expression on Custom Fields

##

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

Less More

- Posts: 56
- Thank you received: 1
-
-

4 years 1 month ago -  4 years 1 month ago [\#345939](#345939) by [jiawen](/forum/user/68179-jiawen "View jiawen's Profile")  *[Regular Expression on Custom Fields](/forum/27-checkout/905234-regular-expression-on-custom-fields#345939 "For the checkout form, I have added few custom fields. For normal registration form, I would like to set the custom fields to required and optional in guest checkout form. Is there any way to do this?")* was created by *[jiawen](/forum/user/68179-jiawen "View jiawen's Profile")*

For the checkout form, I have added few custom fields. For normal registration form, I would like to set the custom fields to required and optional in guest checkout form. Is there any way to do this?

Last edit: 4 years 1 month ago by [jiawen](/forum/user/68179-jiawen "View jiawen's Profile").

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

4 years 1 month ago [\#345943](#345943) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Regular Expression on Custom Fields](/forum/27-checkout/905234-regular-expression-on-custom-fields#345943 "For the checkout form, I have added few custom fields. For normal registration form, I would like to set the custom fields to required and optional in guest checkout form. Is there any way to do this?")*

Hi,

You would need to turn off the required setting of the custom field, and instead, implement the event onBeforeHikaUserRegistration(&amp;$ret, $input_data, $mode) in a plugin of the group "hikashop".
If $mode is equal to 2 then you're in guest mode, and otherwise, you're in registration mode.
In Code:

$ret['userData']

you'll have an object with the user custom fields. And in Code:

$ret['addressData']

you'll have an object with the address custom fields of the billing address. And in Code:

$ret['shippingAddressData']

you'll have an object with the address custom fields of the shipping address.

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

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