Answers.Body: <p>User groups are not a <code>FieldType</code> so you can create a category that matches the title of the <code>userGroup</code> or put the actual category as a field on the <code>User</code> and the <code>Variant</code>. Then in your template do something like this:</p>
  
  <p><code>{% set userGroup = currentUser.userGroup.first() %}</code></p>
  
  <p><code>{% set variants = craft.commerce.variants.product(product).relatedTo(userGroup) %}</code></p>
  
  <p>This would probably be the best way since you aren't reliant on string matching a title to find the correct variants.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-29T18:33:58.600Z
Answers.Text: I am new so....
  
  {% if currentUser.isInGroup( 'priceLevelOne' ) %}
       {% set userGroup = currentUser.priceLevel.first() %}
       {% set variant = craft.commerce.variants.product(parts).relatedTo(userGroup) %}
            {% for variant in product.variants %}
                 Product Number: {{ variant.sku }} |
                 Price:  {{ variant.price|currency(cart.currency) }}
            {% endfor %}
  
  
  
  The category group handle is "userGroup".
  The category title is "Price Level 1" and the slug is "price-level-1".
  
  The field containing the category is "priceLevel".
  
  What do I have wrong.
Answers.UserDisplayName: user1663102
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-29T18:45:01.127Z
Answers.Text: get rid of the conditional about the isInGroup and simply add a category to a user based on their user group. then all you will need is what I provided and sub in your fieldHandle. Also if you are serving this on a product page you should product instead of parts since that is the variable that commerce passes in by default
Answers.UserDisplayName: mcclaskiem
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-29T13:54:51.023Z
Answers.LastActivityDate: 2016-04-29T14:01:42.683Z
Answers.LastEditDate: 2016-04-29T14:01:42.683Z
Answers.UserDisplayName: mcclaskiem
Body: <p>This is my first time using Craft Commerce.  I have a client which needs to have multiple prices for a product.  Customers are in one of three price level groups.  Each price level group has a price unique to them as a variant.  How do I get only the one variant for the appropriate price?</p>
  
  <p>Here is what I tried, but returned all the variants for each price level instead of just one.</p>
  
  <pre><code>                &lt;select name="purchasableId"&gt;
                      {% set purchasable = craft.commerce.products %}
                      {% for purchasable in product.variants %}
                          &lt;option 
                              {% if purchasable.stock &lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} 
                              value="{{ purchasable.purchasableId }}"&gt;
  
                                  Product Number: {{ product.stockDescription1 }} | 
                                  Price: 
  
                                  {% if currentUser.isInGroup( 'priceLevelOne' ) %}
  
                                      {% set variant = craft.commerce.variants %}
                                      {% for variant in product.variants %}
                                          {% if variant.priceLevel1 == 1 %}
                                              Product Number: {{ product.stockDescription1 }} |
                                              Price:
                                              {{ variant.price|currency(cart.currency) }}
                                          {% endif %}
                                      {% endfor %}
  
                                  {% elseif currentUser.isInGroup( 'priceLevelTwo' ) %}
  
                                      {% set variant = craft.commerce.variants %}
                                      {% for variant in product.variants %}
                                          {% if variant.priceLevel1 == 2 %}
                                              Product Number: {{ product.stockDescription1 }} |
                                              Price:
                                              {{ variant.price|currency(cart.currency) }}
                                          {% endif %}
                                      {% endfor %}
  
  
                                  {% elseif currentUser.isInGroup( 'priceLevelThree' ) %}
  
                                      {% set variant = craft.commerce.variants %}
                                      {% for variant in product.variants %}
                                          {% if variant.priceLevel1 == 3 %}
                                              Product Number: {{ product.stockDescription1 }} |
                                              Price:
                                              {{ variant.price|currency(cart.currency) }}
                                          {% endif %}
                                      {% endfor %}
  
                                  {% endif %}
                          &lt;/option&gt;
                      {% endfor %}
                  &lt;/select&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-25T14:14:52.257Z
Comments.Text: You can add custom fields to variants as well, which is what I think you mean by "item." Depending on how you have your products structured you could also create a variant for each custom group which would have the price associated with that and therefore would not effect the checkout flow or having to alter prices of items.
Comments.UserDisplayName: mcclaskiem
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T13:42:46.250Z
Comments.Text: Yes, I have those custom fields in my variants, but I need to limit which variants are displayed.  Each product will have 5 variants, but I only need one variant depending on what user group.  Right now all five variants are returned on the product page.
Comments.UserDisplayName: user1663102
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T13:49:46.857Z
Comments.Text: What is the field type on the variant? If you are using categories, you can do a simple `relatedTo` query to get the one you want, I can provide an example below!
Comments.UserDisplayName: mcclaskiem
Tags: <plugin-craftcommerce>
Title: Multiple Prices based on User in Craft Commerce
ThreadText: # Multiple Prices based on User in Craft Commerce
  
  (Asked by: username_0 on 2016-04-22)
  
  This is my first time using Craft Commerce. I have a client which needs to have multiple prices for a product. Customers are in one of three price level groups. Each price level group has a price unique to them as a variant. How do I get only the one variant for the appropriate price?
  
  Here is what I tried, but returned all the variants for each price level instead of just one.
  
  ```
                  <select name="purchasableId">
                      {% set purchasable = craft.commerce.products %}
                      {% for purchasable in product.variants %}
                          <option 
                              {% if purchasable.stock <= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} 
                              value="{{ purchasable.purchasableId }}">
  
                                  Product Number: {{ product.stockDescription1 }} | 
                                  Price: 
  
                                  {% if currentUser.isInGroup( 'priceLevelOne' ) %}
  
                                      {% set variant = craft.commerce.variants %}
                                      {% for variant in product.variants %}
                                          {% if variant.priceLevel1 == 1 %}
                                              Product Number: {{ product.stockDescription1 }} |
                                              Price:
                                              {{ variant.price|currency(cart.currency) }}
                                          {% endif %}
                                      {% endfor %}
  
                                  {% elseif currentUser.isInGroup( 'priceLevelTwo' ) %}
  
                                      {% set variant = craft.commerce.variants %}
                                      {% for variant in product.variants %}
                                          {% if variant.priceLevel1 == 2 %}
                                              Product Number: {{ product.stockDescription1 }} |
                                              Price:
                                              {{ variant.price|currency(cart.currency) }}
                                          {% endif %}
                                      {% endfor %}
  
                                  {% elseif currentUser.isInGroup( 'priceLevelThree' ) %}
  
                                      {% set variant = craft.commerce.variants %}
                                      {% for variant in product.variants %}
                                          {% if variant.priceLevel1 == 3 %}
                                              Product Number: {{ product.stockDescription1 }} |
                                              Price:
                                              {{ variant.price|currency(cart.currency) }}
                                          {% endif %}
                                      {% endfor %}
  
                                  {% endif %}
                          </option>
                      {% endfor %}
                  </select>
  
  ```
  
  **Tags:** plugin-craftcommerce
  
  > **Comments:**
  > **username_1**: You can add custom fields to variants as well, which is what I think you mean by "item." Depending on how you have your products structured you could also create a variant for each custom group which would have the price associated with that and therefore would not effect the checkout flow or having to alter prices of items.  
  > **username_0**: Yes, I have those custom fields in my variants, but I need to limit which variants are displayed.  Each product will have 5 variants, but I only need one variant depending on what user group.  Right now all five variants are returned on the product page.  
  > **username_1**: What is the field type on the variant? If you are using categories, you can do a simple `relatedTo` query to get the one you want, I can provide an example below!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-04-29. Score: 3
  
  User groups are not a `FieldType` so you can create a category that matches the title of the `userGroup` or put the actual category as a field on the `User` and the `Variant`. Then in your template do something like this:
  
  `{% set userGroup = currentUser.userGroup.first() %}`
  
  `{% set variants = craft.commerce.variants.product(product).relatedTo(userGroup) %}`
  
  This would probably be the best way since you aren't reliant on string matching a title to find the correct variants.
  
  > **Comments:**
  > **username_0**: I am new so....  {% if currentUser.isInGroup( 'priceLevelOne' ) %}      {% set userGroup = currentUser.priceLevel.first() %}      {% set variant = craft.commerce.variants.product(parts).relatedTo(userGroup) %}           {% for variant in product.variants %}                Product Number: {{ variant.sku }} |                Price:  {{ variant.price|currency(cart.currency) }}           {% endfor %}    The category group handle is "userGroup". The category title is "Price Level 1" and the slug is "price-level-1".  The field containing the category is "priceLevel".  What do I have wrong.  
  > **username_1**: get rid of the conditional about the isInGroup and simply add a category to a user based on their user group. then all you will need is what I provided and sub in your fieldHandle. Also if you are serving this on a product page you should product instead of parts since that is the variable that commerce passes in by default  
  
  ---
  
  