Checkbox – Wc Fields Factory

Product Field

Insert a checkbox fields group on the product page.

Option Description
Options Use the Option Factory (Located at the Right Side) to create Check boxs. for manual creation see the below explanation.
Each check box will contains Value attribute (which is not visible to User) with that you will have to provide a caption which convey the purpose of that Check Box.
So basically we need two things to create a single Check Box, Value and Label, Value represent the Value attribute of the checkbox and Label represent the Caption.
Here we represent a single option with “|” delimiter, if more than one option then delimit with new line.

        red|Red     <!-- Check Box 1 -->
        green|Green     <!-- Check Box 2 -->
        blue|Blue     <!-- Check Box 3 -->
        
Default Options Default Options for this radio group, all the check boxes created will be displayed here on real time – (These options will be used incase If user hadn’t chosen any).
Layout How the Checkboxes should be stocked on the screen Vertically or Horizontally.
Required Make this checkboxes group mandatory – user cannot perform Add To Cart operation without choosing this any option.
Message Message that has to be displayed when validation failed for this checkbox group (When the Required Option is Set).
Visibility Whether this checkboxes value (Chosen 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 (Chosen 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 – (incase If user has chosed the 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 (added to each check boxes).
Product Field Raw Output
<table class="wccpf_fields_table ">
	<tbody>
		<tr>
			<!-- Label section starts here -->	
			<td class="wccpf_label">
				<label for="test_check_field">Test Check Field</label>
			</td>
			<!-- Label section ends here -->
			
			<!-- Field section starts here -->
			<td class="wccpf_value">
				<!-- Actual field -->
				<ul class="wccpf-field-layout-horizontal" data-cloneable="yes">
					<li>
						<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccpf-field " name="test_check_field[]" value="red" wccpf-type="checkbox" wccpf-pattern="mandatory" wccpf-mandatory="no"> Red</label>
					</li>
					<li>
						<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccpf-field " name="test_check_field[]" value="blue" checked="" wccpf-type="checkbox" wccpf-pattern="mandatory" wccpf-mandatory="no"> Blue</label>
					</li>
				</ul>
				<!-- Validation message -->
				<span class="wccpf-validation-message">Test product checkbox validation 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 related 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 chosen on this Admin Field instead as the Field itself. Whatever the option, Store Admin chosen for this field on the back end will be displayed on the Front end Product Page.
Tips Whether to show the tip icon in the back end.
Description Tool-tip message, when admin user click on the Tips Icon.
Admin Field Raw Output (on Product Page)
<p class="form-field">
	<!-- Label for the Check Box Group -->
	<label for="test_admin_check">Test Admin Check</label>
	
	<!-- Individual options starts here -->
	<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccaf-field " name="test_admin_check[]" value="red" wccaf-type="checkbox" wccaf-pattern="mandatory" wccaf-mandatory="no"> Red</label>
	<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccaf-field " name="test_admin_check[]" value="blue" wccaf-type="checkbox" wccaf-pattern="mandatory" wccaf-mandatory="no"> Blue</label>
	<!-- Individual options ends here -->
	
	<!-- Validation message -->
	<span class="wccaf-validation-message">This field can't be Empty</span>
</p>
Admin Field Raw Output (on Product Category Create Page)
<div class="form-field">
	<!-- Label for the Check Box Group -->
	<label for="test_admin_check">Test Admin Check</label>
	
	<!-- Individual options starts here -->
	<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccaf-field " name="test_admin_check[]" value="red" wccaf-type="checkbox" wccaf-pattern="mandatory" wccaf-mandatory="no"> Red</label>
	<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccaf-field " name="test_admin_check[]" value="blue" wccaf-type="checkbox" wccaf-pattern="mandatory" wccaf-mandatory="no"> Blue</label>
	<!-- Individual options ends here -->
	
	<!-- Validation message -->
	<span class="wccaf-validation-message">This field can't be Empty</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_check">Test Admin Check</label>
	</th>
	<!-- Admin Edit Category field's label ends here -->
		
	<td>
		<!-- Individual options starts here -->
		<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccaf-field " name="test_admin_check[]" value="red" wccaf-type="checkbox" wccaf-pattern="mandatory" wccaf-mandatory="no"> Red</label>
		<label class="wcff-option-wrapper-label"><input type="checkbox" class="wccaf-field " name="test_admin_check[]" value="blue" wccaf-type="checkbox" wccaf-pattern="mandatory" wccaf-mandatory="no"> Blue</label>
		<!-- Individual options ends here -->
		
		<!-- Validation message -->
		<span class="wccaf-validation-message">This field can't be Empty</span>
	</td>	
</tr>

Leave a Reply to Alban Cancel reply

Your email address will not be published.

 

10 Comment(s)

  1. Riccardo January 19, 2023

    Hi Sark,
    I’d like to use field rules in checkout fields. Just same logic as you are already using in product fields. Is there any chance to get this feature?

    Thanks in advance!

    Riccardo

  2. Jürgen February 10, 2022

    Hello Saravana,
    Your pluging is very cool, but when I create a Check Box – Field and store the Field-Group the Check Box is broken: no Field Label, no Field Name and no Field Type is visible. I can’t open the field, only delete it. Is it possible to fix this bug? Many thanks for feedback.

    1. Saravana Kumar K February 10, 2022

      Hi, sure, pls share a temp access to your wp-admin, I wilk try to fix it.
      email : sark@sarkware.com

  3. Alban December 12, 2017

    Hello Saravana,
    i got quite the same problem : i work on a website for a restaurant, they have some products and i want to make some checkbox or radio button for some option.
    For example : is it possible to pick up this product, is it the suggestion of the day, is it a frozen product, is it available in A restaurant or in B restaurant (or both).
    This fields needs to be updated sometimes (for the availability).
    Is it possible with this plugin, because when i change some values and update the product in the BO, the values doesn’t change.

    1. Saravana Kumar K December 12, 2017

      I think, I should change the behaviour, but when.?

      The default value should be applied at the very first time, once admin changed to any thing (even empty the field) then the default value should not take into the place.

      Does it make sense.?

      1. Alban December 12, 2017

        I think it’s a weird behaviour, because if i set to blank a default option, then i go on the product BO, and i tick this option, update product, ..TADA my option still to blank (as specified on default value).

        1. Saravana Kumar K December 13, 2017

          Hi the behaviour is fixed in Version 2.0.5, please update and check

  4. Charles December 8, 2017

    Hello, first of all thank you for this awesome plugin.

    I have a problem on the checkbox type. When I have options, I can’t unckeck all of them, follow thoses steps to get my problem :
    1- After creating 2 options on a checkbox field in the admin fields factory, I check both on my product page and I make an update to my product.
    2- Then I tryed to uncheck both and after a new update, both checkbox stay check.

    Can you help me to fix this issus,

    Best Regards

    1. Saravana Kumar K December 8, 2017

      Hi, that is the behaviour, If you have chosen a default option for checkbox (not only checkbox any field in this matter, especially for Admin Fields), if admin failed to choose any option then the default option will be used instead.

      In other word If you specify default value then the field cannot be empty (if admin failed to fill then the Fields Factory fill it automatically).

      I did have some dilemma over this decision but then there is no point of keeping default option right.?
      What do you think.?

    2. Saravana Kumar K December 13, 2017

      Hi the behaviour is fixed in Version 2.0.5, please update and check