View Product Page

Conditional fields

Do you want to show the checkout fields with conditional logic? And so, make sure that only if a condition is met, a specific field will appear? Or that a specific field in shown only if one or more specific products are in the cart? Now, you can!

Whenever you set up a new field, you will be able to set up if it has to be linked to any other field in the checkout and what has been selected in it.

How to?

You can simply set up this in the field that will be shown or hidden conditionally, in the last section:

Conditional fields

Here, you can set the following options:

  • Field: select the field that will work as a condition. As a condition you can also check the cart contents, so select either Products in cart or one of the existing checkout fields.
  • Condition: select the condition for the field to show. You can select one among the following:
    • Is set
    • Is empty
    • Value is
    • Value is not
    • All selected products in cart
    • At least one selected product in cart
    • All selected categories in cart
    • At least one selected category in cart
  • Value: enter the value of the field to trigger the conditional behavior. Please note that if the condition regards products or categories, you should enter here the product/category IDs separated by commas.
  • Action: choose whether to show or hide the current field if the condition is fulfilled.
  • Required: check if the current field has to be set as Required only if the condition is fulfilled. Make sure the default Required value (above) is not checked, otherwise, this setting will not take effect.
  • More conditions: you can set up more than one condition for the same field. Simply click on the + (plus) sign to add more or on the X to remove some.

Let’s give a couple of examples to show how to set up a conditional field.

Example 1. Required VAT for Company billing

You want to let users choose between Private and Company billing. Only if they choose Company, you will show a required VAT field, otherwise, the field won’t show.

How to set it up?

Go to YITH > Checkout Manager > Checkout fields and create a radio-button field where your customers can choose if they are Private or Company and save.

Then, create another field where the user can enter the VAT number. This field has to appear only if Company has been selected first. So, configure it like this:

  • Field: select the above-created field: Are you purchasing as a private or company?
  • Condition: Value is
  • Value: Company
  • Action: show
  • Required: checked

Example 2. Products in cart

You might want to offer free wrapping for products belonging to a specific category only, which can be optionally checked by the user in checkout.

To do that, you can configure the condition like this:

Where Value is the category ID (T-shirts category ID is 18)