I am trying to prepopulate the following fields on a commerce add-to-cart form and then hide the email field:

  1. Recipient name: (textfield) = field_recipient_name
  2. Recipient email: (email field) = field_recipient_email

So far i have been able to pre-populate these fields using views, panels, and prepopulate modules. My challenge is this:

If the email field is already prepopulated with a value, hide this field from the user who intends to buy a gift for the recipient, otherwise the field should be exposed so that user can manually enter the email of the gift recipient. Thanks

1 Answer 1


Perhaps you can use the Conditional Fields module to check whether the field has a value (sort of a 'not empty' check).

Conditional Fields is described as follows:

Conditional Fields allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing and displayed if the state of the “dependee” field matches the right condition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.