From version 6 you are able to add extra fields to coupons, products, stores, categories, etc.
For a better understanding we’ll start with a small example of extra field added to stores:
$extra_fields = array();
$extra_fields['owner'] = array( 'type' => 'text', 'title' => 'Store Owner', 'default' => '' );
add( 'store-fields', array( 'position' => 1, 'fields' => $extra_fields) );
From now you’ll see an extra field appeard in Edit/Add Store form, after you save some information in these fields you’ll be able to get that information using extra( $id ); function on store’s profile from your theme.
For the example above you need to use extra( ‘owner‘ ); and you’ll be able to get the information from the new added field. It could be used in store.php only.
The same could be applied for coupons, products and categories.
All options available for “type” argument:
- select (“options” argument should be used as an array of dropdown options)
* These types could be also be used for widgets and theme options.
Leave a Reply