Hi all,
just a quick sharing.
I wanted to add a custom field for Vendor Settings in WCFM. The field will be a checkbox with a label of "Verified". This field can only be filled by an admin.
The purpose tells is to tell whether this vendor is verified or not and data is stored in `wp_usermeta` table.
Okay, of course, if I use the paid extension for WCFM plugin this feature already included. But come on! I just want to add this simple function without paying any penny :P
Thus I decided to DIM (Do it Myself).
I was lucky that previously other WCFM users did a custom field for Vendor Settings and shared his solution on the WCFM forum. Aha.
So I tested out, in the beginning, it was not working. The working code I included here for your reference. I also added the admin user check to ensure the field is only loaded for admin view :D. This code needed to be in your child theme `functions.php`!
The code first will add the new field to the vendor setting form, then the value "is_verified" that passed from the form will be updated to the vendor user meta value for meta key `is_verified`.
Result:
Reference:
https://wclovers.com/forums/topic/custom-field-for-vendor-settings/
P/s: give me a shout, any questions? don't hesitate to leave your comment! I'll try to help out!
just a quick sharing.
How to add Custom Field for Vendor Settings in WCFM
I wanted to add a custom field for Vendor Settings in WCFM. The field will be a checkbox with a label of "Verified". This field can only be filled by an admin.
The purpose tells is to tell whether this vendor is verified or not and data is stored in `wp_usermeta` table.
Okay, of course, if I use the paid extension for WCFM plugin this feature already included. But come on! I just want to add this simple function without paying any penny :P
Thus I decided to DIM (Do it Myself).
I was lucky that previously other WCFM users did a custom field for Vendor Settings and shared his solution on the WCFM forum. Aha.
So I tested out, in the beginning, it was not working. The working code I included here for your reference. I also added the admin user check to ensure the field is only loaded for admin view :D. This code needed to be in your child theme `functions.php`!
The code first will add the new field to the vendor setting form, then the value "is_verified" that passed from the form will be updated to the vendor user meta value for meta key `is_verified`.
Result:
The custom field will be showing in Vendor store settings. Only visible to admin user :D |
Reference:
https://wclovers.com/forums/topic/custom-field-for-vendor-settings/
P/s: give me a shout, any questions? don't hesitate to leave your comment! I'll try to help out!
Comments
Post a Comment