LIVEOPENCART

Parent-child Options

Description

Show customers only the options they need. Parent-child Options lets you show or hide product options based on earlier choices. Show a text field when a customer chooses engraving, ask for the grind size when they choose ground coffee, or show wrapping styles when they select gift wrapping.

  • Show dependent fields as customers make their choices, without reloading the page.
  • Connect several options or build a sequence of dependent choices.
  • Let customers add products to the cart without filling in hidden fields.
  • Set up rules in the product editor and transfer them with CSV or XLSX files.

For OpenCart 4.1.0.4.

Let each choice reveal the next step

In the gift box example, selecting Gift wrapping reveals the wrapping style. Selecting Name tag reveals the recipient's name. Each extra controls its own fields, so customers can choose either, both or neither.

Cosy Moments Gift Box demonstration: the cursor selects Gift wrapping and Name tag to reveal their fields, then clears each choice to hide its fields.

The demonstration uses the real demo controls and product photo. The photo stays the same; Parent-child Options changes which fields are shown.

Try the gift box options yourself.

Build simple rules or a sequence of choices

A parent is the option the customer chooses first. A child is the option shown when that choice matches your rule. For example, Gift extras is the parent of Recipient name.

One parent can control several children, and a child can become the parent of another option. In the vest demo, Front only reveals the front design selector. Choosing Custom text then reveals a text field. Choosing No printing hides the whole sequence.

Personalised Vest with Front only and Custom text selected. The Front text field appears below these two choices.

Explore the vest's dependent options.

A child can also depend on more than one parent:

  • AND: every parent condition without the OR setting must match.
  • OR: if any conditions have OR enabled, at least one of them must match. All conditions without OR must still match.

Use Select, Radio or Checkbox options as parents. Any standard OpenCart option type can be a child, including text, file uploads, dates and times.

Set the rules where you edit your products

Open the product's Option tab. In the child option, click Add parent option, choose the parent, then select the values that should show the child. Add more parent conditions when needed.

The gift box rule below shows Recipient name only when Name tag is selected under Gift extras. The field is required when visible.

Recipient name option settings: Required is enabled, Gift extras is the parent, and Name tag is the selected trigger value.

Parent and child highlighting helps you follow the relationships in the editor. You can turn highlighting off without changing your rules.

Keep hidden fields out of the way

Customers only need to fill in a required child option while it is visible. When their choices no longer match its rules, the child is hidden and its previous value is cleared. It does not block adding the product to the cart. When it appears again, a default value is restored if one is available and allowed by the rules.

The same dependency rules apply when you add products to a new or existing order in the administration panel.

Use rules with native product Variants

Set up rules on the master product. Its child Variants use those same rules, without a separate copy to maintain. A fixed Variant value counts as a selection even when its control is not shown. An option hidden by the Variant without a value stays unselected, and the extension does not reveal options that the Variant keeps hidden.

Import and export your rules

Use the separate Export and Import tabs to transfer dependencies as CSV or XLSX. Import can append rules or replace all existing Parent-child Options rules. The complete file is validated before saved rules change.

Choose catalog option IDs for ordinary setups, or exact product option row IDs when the same option occurs more than once in a product. Export and import rules for master products, not their child Variants.

CSV is ready to use. For XLSX, use Install XLSX support on the extension page to download and install the required library.

Check that it fits your store

Parent-child Options shows and hides whole options. It does not filter individual values inside a selector, create product Variants, or manage prices and stock for combinations of values. Custom themes, checkouts and other option extensions may need a separate compatibility check.

Explore the storefront examples, or inspect the administration demo with username demo and password demo.

Not sure whether it fits your setup? Email support@liveopencart.com with your OpenCart version, theme and relevant extensions.