Body: <p>I'm new to Craft Commerce.</p>
  
  <p>I wish to add around 10 price tiers to each product. Users are in groups and the group determines which price tier they pay. All the data is to be imported (and kept up to date) via API from an inventory management system. There are around 5000 products.</p>
  
  <p>Sales and Discounts do not seem to be a good option as these are applied to whole groups of products whereas in my case each product has different pricing at each tier - there is no standard formula.</p>
  
  <p>Another SE question,
  <a href="https://craftcms.stackexchange.com/questions/14769/multiple-prices-based-on-user-in-craft-commerce">Multiple Prices based on User in Craft Commerce</a>, uses variants. Is this the best way to go? For me the only difference is price so I feel it is not really a variant and this is a rather cluttered approach, especially as for each variant I will have to repeat a number of other fields. (And I might want to be able to use variants for the real variants rather than have the real variants as separate products to avoid a variants-squared situation).</p>
  
  <p>So, I'm looking for advice on overall direction. It will be Craft 3/Commerce 2. TIA.</p>
  
  <p><strong>UPDATE:</strong> I was able to import the price tiers into custom fields on each product, and then on the product page display the correct price based on the user category selecting the right price tier. And then use this in a hidden field - I had to use options because I couldn't get it to work otherwise - not sure what I was doing wrong:</p>
  
  <pre><code>&lt;input type="hidden" name="options[customPrice]" value="{{price}}"&gt;
  </code></pre>
  
  <p>Then (not knowing much anything about OOP PHP, but being a good scrounger who can copy and paste) I was able to modify the line item in the checkout page like so in Plugin class:</p>
  
  <pre><code>public function init() {
    Event::on(LineItems::class, LineItems::EVENT_POPULATE_LINE_ITEM, function(LineItemEvent $e) {
      $lineItem = $e-&gt;lineItem;
      if(isset($lineItem-&gt;options['customPrice'])){
          $lineItem-&gt;price =  $lineItem-&gt;options['customPrice']; 
      }
  });
  }
  </code></pre>
  
  <p>It seems to work, but who knows what sensibility boundaries I have crossed. The OOP side of things may as well be Greek to me.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-11T01:47:21.140Z
Comments.Text: P.S. I'm not yet confident/competent enough to write a plugin or module - but if that is the way I need to go, I'll just have to learn :)
Comments.UserDisplayName: Jack McKenzie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-11T08:00:26.723Z
Comments.Text: Writing a simple plugin/module would be the way to go. I will make an answer with an example plugin soon.
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-14T23:41:45.817Z
Comments.Text: Thanks @LukeHolder - I had a go in the UPDATE above, but it might be obvious I am stabbing in the dark
Comments.UserDisplayName: Jack McKenzie
Tags: <plugin-craftcommerce2>
Title: How best to add price tiers based on user group
ThreadText: # How best to add price tiers based on user group
  
  (Asked by: username_0 on 2019-01-11)
  
  I'm new to Craft Commerce.
  
  I wish to add around 10 price tiers to each product. Users are in groups and the group determines which price tier they pay. All the data is to be imported (and kept up to date) via API from an inventory management system. There are around 5000 products.
  
  Sales and Discounts do not seem to be a good option as these are applied to whole groups of products whereas in my case each product has different pricing at each tier - there is no standard formula.
  
  Another SE question,
  [Multiple Prices based on User in Craft Commerce](https://craftcms.stackexchange.com/questions/14769/multiple-prices-based-on-user-in-craft-commerce), uses variants. Is this the best way to go? For me the only difference is price so I feel it is not really a variant and this is a rather cluttered approach, especially as for each variant I will have to repeat a number of other fields. (And I might want to be able to use variants for the real variants rather than have the real variants as separate products to avoid a variants-squared situation).
  
  So, I'm looking for advice on overall direction. It will be Craft 3/Commerce 2. TIA.
  
  **UPDATE:** I was able to import the price tiers into custom fields on each product, and then on the product page display the correct price based on the user category selecting the right price tier. And then use this in a hidden field - I had to use options because I couldn't get it to work otherwise - not sure what I was doing wrong:
  
  ```
  <input type="hidden" name="options[customPrice]" value="{{price}}">
  
  ```
  
  Then (not knowing much anything about OOP PHP, but being a good scrounger who can copy and paste) I was able to modify the line item in the checkout page like so in Plugin class:
  
  ```
  public function init() {
    Event::on(LineItems::class, LineItems::EVENT_POPULATE_LINE_ITEM, function(LineItemEvent $e) {
      $lineItem = $e->lineItem;
      if(isset($lineItem->options['customPrice'])){
          $lineItem->price =  $lineItem->options['customPrice']; 
      }
  });
  }
  
  ```
  
  It seems to work, but who knows what sensibility boundaries I have crossed. The OOP side of things may as well be Greek to me.
  
  **Tags:** plugin-craftcommerce2
  
  > **Comments:**
  > **username_0**: P.S. I'm not yet confident/competent enough to write a plugin or module - but if that is the way I need to go, I'll just have to learn :)  
  > **username_1**: Writing a simple plugin/module would be the way to go. I will make an answer with an example plugin soon.  
  > **username_0**: Thanks @username_1 - I had a go in the UPDATE above, but it might be obvious I am stabbing in the dark  
  
  ---
  
  ## 0 answers
  
  