Title: Conditional attributes/addons and content
Last modified: January 6, 2017

---

# Conditional attributes/addons and content

 *  [insertdelete](https://wordpress.org/support/users/insertdelete/)
 * (@insertdelete)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/conditional-attributesaddons-and-content/)
 * Hi,
    I have quite a complicated use case here, so I will do my best to explain.
   I am using WooCommerce to sell bookings to events. The booking is for a hotel
   room.
 * A visual representation to explain the flow:
    ⌊visual rep⌉
 * Now, for the first part, the user should be able to select a maximum number of
   either male/female attendees. There should be a price per unit of male/female
   adult. And a max total of male and female.
 * Then for the second part, the user should be able to select a max number of infants,
   and then a max number of childrens/teens (in total). There should be a price 
   per unit of infant/children/teen.
 * And for the third part, IF children/teen are selected, and option to enrol them
   into a ‘youth programme’ should be enabled. There should be a price per unit.
   The max quantity allowed here should be the total of children/teen.
 * —————–
 * I understand that I can do most of this using WooCommerce’s Product Addons plugin,
   however I don’t think it will allow setting max quantity value per ‘product addon’.
   
   The complication lies in some room bookings having max space for 4 young people(
   children and teens, two different attributes/products addons), so how would I
   limit the max selected total of two different attributes/products addons? If 
   for example one room has max space for 4 young people, this could be a variation
   of 2 children + 2 teens, or 1 child + 3 teens, etc. Also, if there are 2 young
   people (children and teens) in total, then the max quanity allowed in ‘youth 
   programme’ should be the total of children+teen.
 * —————–
 * Now, for the second part; if the user selects x number of children/teen to enrol
   into the ‘youth programme’ (for which the max value which should be a total of
   the selected children + teen count), there should be a way to collect the names/
   ages or those people.
 * —————–
 * I hope this isn’t too complicated, and possible through existing WooCommerce 
   plugins.
 * I appreciate anyone’s advice/guidance.
 * Thank
    -  This topic was modified 9 years, 7 months ago by [insertdelete](https://wordpress.org/support/users/insertdelete/).
    -  This topic was modified 9 years, 7 months ago by [insertdelete](https://wordpress.org/support/users/insertdelete/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [insertdelete](https://wordpress.org/support/users/insertdelete/)
 * (@insertdelete)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/conditional-attributesaddons-and-content/#post-8627584)
 * Ok, I’ve just read up on Gravity Forms Product Addon, and I can see that I can
   probably do all of this with that plugin, except it would require a LOT of conditionals.
   If anyone has an idea how to minimise the conditions, I would appreciate it.
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/conditional-attributesaddons-and-content/#post-8627768)
 * Form starts with just 2 fields showing **Number of Adults** with a default of
   1 and max # set ,and,
    **How many children** with a default of 0 and max # set(
   drop down works well for that)
 * There is a section of fields that will then show based on # of adults > 0. Change
   select option to 2 and 2 show sections (form conditional logic).
 * Each of those section asks the M of F and Age Q’s (with an explanation of why
   you ask this) (pricing)
 * When they change that to a quantity of kids > 0 (of which the select option is
   based on a calc of max total minus # of adults picked above), a section shows
   up for each child with the Q’s for each. Age, program. (pricing)
 * If a program is chosen, you could add more detail.
 * So it starts out simple, just 1 adult no kids. Fields are displayed when those
   options are changed.
 * Create your matrix of options, pricing, and use to do the calculations in the
   form.
 * The pricing fields (most hidden), do the calculations for the total price.
 * The GF Fields are added to the Order (as desired, fields can be hidden, admin,
   etc).
 * Pricing fields can be pre-populated using functions.php with a set of pricing
   variables in a nice list that can be easily updated as needed (next year, sale).
 * How’s that for a start?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conditional attributes/addons and content’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3640790)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/conditional-attributesaddons-and-content/#post-8627768)
 * Status: not resolved