Options are special form fields which a customer can interact with. They are used to make a product customizable by the customer, give him an opportunity to add personalized information and calculate the price based on the information received through the options.
Probably most commonly used type of Option :) Adds a possibility to use simple text input, though with an opportunity to make it
decimalfield or even use conditional validation logic (at the moment, this functionality is enabled for this Option only).
Adds a simple text area field.
Adds a dropdown - a possibility to choose only one value.
Adds radio input fields - a possibility to choose only one value.
Adds checkboxes - a possibility to select more than one value.
Adds nice JS based date picker with two modes: single date and dates range.
Adds nice JS based AJAX file upload field.
Adds a possibility to display some data like regular and non option variables values as well as perform virtually any operations with these data by using JS code.
Adds nice JS based range slider. Can be of two types: single and double.
Adds a matrix-like table with a possibility to choose any value from it. The info about chosen column name, row name and the value in the intersection of the column and the row will be available in the cart item meta.
Every option has a state, it can be either 'synced' or 'not synced'. Option's state shows whether the current instance of Option is activated, i.e., actually works like a form field with its own name, or not.
This is how this setting looks like when you have just created an Option instance (i.e., dragged it from the builder panel and dropped to the builder content area):
⚠️ Not synced Option instances are just dummy copies. They do not work as form fields. They cannot be used neither in price calculation nor in fields conditional logic. They must be synced (activated) prior using as Options.
These are the ways to activate Option:
- 1.Save option's settings with a unique slug name to DB.
- 2.Choose "Connect" in Sync setting, click on the blue arrow icon in order to fetch Options of the same type available in the DB, click on "Submit" button (it will appear next to the select field).
First method is most suitable for creating completely new Option.
The second method is most suitable for re-using already created Option.
This is how Sync setting looks like when a certain Option instance is activated:
ID #123is the ID of a custom post type post in WordPress.
There a couple of reasons for that:
- Syncing basically means the process of creation of an Option object in DB (custom post type object in terms of WordPress).
- To be able to keep a "master" copy of Option in DB and a bit different copies-instances of the Option in the products.
- To be able to easily re-use Options in different products.
- To be able to manage price-related settings of all the Option instances of the site in one place, instead of editing every instance one by one (this is future feature, it is not possible at the moment as "Options Manager" is not created yet).
The last question you may have is "Why I need Unsync button at all?". As you may already guessed, this button actually detaches an Option's instance (make it unsynchronized) from its "master" copy stored in DB. It may happen that you need to completely new Option based on the existing synced instance. Then you have to unsync this instance first, then you can add a unique slug and save to DB. ⚠️ Without detaching Option's instance, saving its settings with a new slug to DB will lead to overwriting connected "master" copy of the Option!