Answers.Body: <p>Checkboxes fields (and other multi-select fieldtypes) return a <a href="https://craftcms.com/classreference/fieldtypes/MultiOptionsFieldData" rel="nofollow">MultiOptionsFieldData</a> instance, not an array.</p>
  
  <p>This should work:</p>
  
  <pre><code>{% if currentUser.userField.contains(purchaseable.myCustomField) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-02T02:02:58.660Z
Answers.Text: Worked perfectly. You are spot-on, I was approaching it as an array. Thank you!
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-01T22:30:14.927Z
Answers.LastActivityDate: 2016-01-01T22:30:14.927Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I have a product variant that a user can choose from. It looks like this:</p>
  
  <pre><code>&lt;select name="purchasableId" class="form-control"&gt;
      {% for purchasable in product.variants %}
          &lt;option {% if purchasable.stock &lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value="{{ purchasable.purchasableId }}"
              {% if currentUser is defined and purchasable.myCustomField in currentUser.userField %}selected{% endif %}&gt;{{ purchasable.myCustomField.label }} &amp;ndash; {{ purchasable.price|currency(cart.currency) }}&lt;/option&gt;
     {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
  <p>Where I'm stuck is this:</p>
  
  <pre><code>purchasable.myCustomField
  </code></pre>
  
  <p>Should (and does) equal this:</p>
  
  <pre><code>{{ currentUser.userField }}
  </code></pre>
  
  <p>I know it's a syntax problem... just not sure where I'm off.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>To test, this is what the data looks like:</p>
  
  <pre><code>purchasable.myCustomField  // this is a drop down value is "blue"
  currentUser.userField      // this is a checkbox that has the value "blue" in it
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-01T21:08:54.833Z
Comments.Text: What FieldTypes are `purchasable.myCustomField` and `currentUser.userField`?
Comments.UserDisplayName: Mats Mikkel Rummelhoff
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-01T21:10:59.473Z
Comments.Text: `purchasable.myCustomField` is a drop-down & `currentUser.userField` is a checkbox group. So I am trying to see if `purchasable.myCustomField` is in `currentUser.userField`
Comments.UserDisplayName: Damon
Tags: <user-profile><plugin-craftcommerce>
Title: How can I pre-select a product variant based on user profile?
ThreadText: # How can I pre-select a product variant based on user profile?
  
  (Asked by: username_0 on 2016-01-01)
  
  I have a product variant that a user can choose from. It looks like this:
  
  ```
  <select name="purchasableId" class="form-control">
      {% for purchasable in product.variants %}
          <option {% if purchasable.stock <= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value="{{ purchasable.purchasableId }}"
              {% if currentUser is defined and purchasable.myCustomField in currentUser.userField %}selected{% endif %}>{{ purchasable.myCustomField.label }} &ndash; {{ purchasable.price|currency(cart.currency) }}</option>
     {% endfor %}
  </select>
  
  ```
  
  Where I'm stuck is this:
  
  ```
  purchasable.myCustomField
  
  ```
  
  Should (and does) equal this:
  
  ```
  {{ currentUser.userField }}
  
  ```
  
  I know it's a syntax problem... just not sure where I'm off.
  
  **EDIT**
  
  To test, this is what the data looks like:
  
  ```
  purchasable.myCustomField  // this is a drop down value is "blue"
  currentUser.userField      // this is a checkbox that has the value "blue" in it
  
  ```
  
  **Tags:** user-profile, plugin-craftcommerce
  
  > **Comments:**
  > **username_1**: What FieldTypes are `purchasable.myCustomField` and `currentUser.userField`?  
  > **username_0**: `purchasable.myCustomField` is a drop-down & `currentUser.userField` is a checkbox group. So I am trying to see if `purchasable.myCustomField` is in `currentUser.userField`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-01-01. Score: 1 | Accepted answer
  
  Checkboxes fields (and other multi-select fieldtypes) return a [MultiOptionsFieldData](https://craftcms.com/classreference/fieldtypes/MultiOptionsFieldData) instance, not an array.
  
  This should work:
  
  ```
  {% if currentUser.userField.contains(purchaseable.myCustomField) %}
  
  ```
  
  > **Comments:**
  > **username_0**: Worked perfectly. You are spot-on, I was approaching it as an array. Thank you!  
  
  ---
  
  