Conditional Fields for Variable Downloads
The ability to have conditional fields on variable downloads is something that we’ve been asked about a lot over the years. It is now possible to display fields conditionally based on the download’s variation that is in the customer’s cart.
How Does This Work?
First, you need to have a download that has one or more variations. Many people use Easy Digital Downloads for selling services, so for this example we’ll assume our “download” is a service.
For this service you need to get the customer’s website URL, or links to their Facebook or Twitter accounts. It would be confusing if you had a generic URL field on the checkout page. They might think you’re asking for irrelevant information and not be sure what to enter there.
So in this case we want to ask customers who purchase the “Website Review” the website URL that they’d like reviewed. Customers who purchase either the Facebook or Twitter option should be asked for links to their profiles. And customers who purchase the “Website, Twitter and Facebook Review” option should get fields for all three.
Add A Conditional Checkout Field In Easy Digital Downloads For A Specific Product Variation
You’ll need to create three fields. (1) the website URL, (2) Facebook profile, and (3) Twitter profile.
First, navigate to Downloads > Conditional Fields > Conditional Fields tab, and click the Add New Field button at the top.
Many of the settings for this field will depend on the type of information you are collecting. We’ll touch on some of the options you might want to use. The steps shown here can be repeated for each of the three fields.
- Title: Make this specific to what information you are collecting from your customer. Something like “[Website URL|Facebook Profile|Twitter Profile] To Be Reviewed” would work just fine.
- Required Field: If you must have this information before a customer checks out, check this box.
- Required Field Error Message: Enter some descriptive text to let your customers know that this field is required.
- Repeat Field: If your customers can purchase more than one review, it might make sense to have the field repeat (i.e. show up once for whatever quantity they are purchasing).
- Products: Select the product you created for this event.
- Product Variation IDs: Enter a comma separated list of variation IDs that should trigger this field. If your product has variation IDs 1, 2, 3 and you want the field to show for variations 2, and 3 you would enter 2,3. In our example, we’ll use the following:
- Website review URL field: 1,4
- Twitter review field: 2,4
- Facebook review field: 3,4
- Each field uses variation 4, as that variation includes each of the reviews.
- Input Type: This will vary based on the type of information you’re trying to collect. In this example we want to collect links to websites, which will work fine in a text field.
Display Conditional Fields For Product Variations In Easy Digital Downloads
Now, a customer will see the conditional fields as appropriate for the product variation that they are purchasing.
For example, if they purchase just the website review option, they would see this:
If they purchase two separate options, like the website and Twitter review, they would see this:
Finally, if they purchase the bundled option (website, Twitter, and Facebook), they would see this: