Product Field
Insert a number field (input[type=number]
) on the product page.
Option | Description |
---|---|
Placeholder | Placeholder attribute’s value for this text field |
Default Value | Default value for this number field – (This value will be used in-case If user hadn’t given any) |
Minimum Value | Minimum value that this number field allow user to input |
Maximum Value | Maximum value that this number field allow user to input |
Step Size | Define the legal number that this number field will accept (If step size “2” then the field will accept only multiplies of “2” like -2, 0, 2, 4, 6….). |
Required | Make this number field mandatory – user cannot perform Add To Cart operation without filling this number field. |
Message | Message that has to be displayed when validation failed for this number field (When the Required Option is Set). |
Visibility | Whether this number field’s value (Given by the user) has to be displayed on the Cart & Check Page Note: Regardless of this option this fields value will be added as Order Meta (Unless you configured not so). |
Order Item Meta | Whether to add this field’s value (Given by the user) as Order Item Meta. |
Logged in Users Only | Make this field available only for the Registered Users only (They must have to be logged in). |
Target Roles | Make this field available only for the users that have the selected roles. Available to all, if you haven’t selected any |
Editable | Make this field’s value editable on Cart Page – (In case If user has gave a wrong value, he can correct it on the cart page itself, no need to go back to product page). Note: this is only for the Cart page not for the Checkout Page. |
Cloneable | Exclude this field from cloning (Works only if Cloning option is enabled from the Settings Page). |
Field Class | Use this option to add a custom css class to this field for your own styling purpose. |
Product Field Raw Output
<table class="wccpf_fields_table"> <tbody> <tr> <!-- Label section starts here --> <td class="wccpf_label"> <label for="test_number_field">Test Number Field</label> </td> <!-- Label section ends here --> <!-- Field section starts here --> <td class="wccpf_value"> <!-- Actual field --> <input type="number" class="wccpf-field" name="test_number_field" value="" placeholder="" min="" max="" step="" wccpf-type="number" wccpf-pattern="number" wccpf-mandatory="no" data-cloneable="yes"> <!-- Validation message --> <span class="wccpf-validation-message">Test number validation error message</span> </td> <!-- Field section ends here --> </tr> </tbody> </table>
Admin Field
All the above options available for the Admin Field as well, along with those there are some specific options releated to only Admin Fields.
Option | Description |
---|---|
Show on Product Page | Show this field on Front end Product page as well. |
Read Only | Whether to show this field as Read Only Field (applicable only on Front End Product Page). |
Value or Field | Show the value that is entered on this Admin Field instead as the Field itself. Whatever the value, Store Admin set for this field on the back end will be displayed on the Fron end Product Page. |
Tips | Whether to show thge tip icon in the back end. |
Description | Tooltip message, when admin user click on the Tips Icon. |
Admin Field Raw Output (on Product Page)
<p class="form-field test_admin_text_field"> <!-- Admin field Label --> <label for="test_admin_text">Test Admin Number</label> <!-- Actual admin field --> <input type="number" class="wccaf-field" name="test_admin_text" value="" placeholder="" min="" max="" step="" wccaf-type="text" wccaf-pattern="number" wccaf-mandatory="no"> <!-- Validation message --> <span class="wccaf-validation-message">Test admin number vallidation error message</span> </p>
Admin Field Raw Output (on Product Category Create Page)
<div class="form-field"> <!-- Admin field Label --> <label for="test_admin_text">Test Admin Number</label> <!-- Actual admin field --> <input type="number" class="wccaf-field " name="test_admin_number" value="" placeholder="" min="" max="" step="" wccaf-type="number" wccaf-pattern="number" wccaf-mandatory="no"> <!-- Validation message --> <span class="wccaf-validation-message">Test admin number vallidation error message</span> </div>
Admin Field Raw Output (on Product Category Edit Page)
<tr class="form-field"> <!-- Admin Edit Category field's label starts here --> <th scope="row" valign="top"> <label for="test_admin_text">Test Admin Number</label> </th> <!-- Admin Edit Category field's label ends here --> <!-- Admin Edit Category actual field starts here --> <td> <input type="number" class="wccaf-field" name="test_admin_text" value="" placeholder="" min="" max="" step="" wccaf-type="number" wccaf-pattern="number" wccaf-mandatory="no"> <span class="wccaf-validation-message"></span> </td> <!-- Admin Edit Category actual field ends here --> </tr>
khubbaib Naeem December 14, 2017
How i allow decimals in number fields.. When i use it gives the error…
Saravana Kumar K December 17, 2017
You mean the Client Side Validation not allowing decimal number.? if it is then just disable the Client Side Validation, I will update the Regexp on my next release.