Answers.Body: <p>You can add custom fields to store the 'other' price for your products (and/or variants), like, as you say, a matrix, or probably even a table would do.  The fields can then be edited by admins in the back end.</p>
  
  <p>In your templates, you'd selectively display whichever price the particular market needs - this would just be basic template logic.</p>
  
  <p>Then, you'll also need a simple custom plugin that listens to <code>onPopulateLineItem</code> and checks which market the customer is in, and modifies the lineItem price accordingly (by retrieving the correct price form the appropriate field).  Once the lineItem prices are modified as appropriate, they'll be used for the payments and stored with the order, factored into totals etc.</p>
  
  <p>There is an example of modifying a lineItem in the docs here:
  <a href="https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem" rel="nofollow noreferrer">https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem</a></p>
  
  <p>Unless you have other requirements not mentioned, for someone with Commerce experience, that would be really be quite simple to implement.</p>
  
  <p>(Based on ~ a years work with Commerce and related plugin writing).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-25T09:28:49.453Z
Answers.Text: I created a plugin for this exact same thing: https://github.com/cliveportman/priceswitcher
Answers.UserDisplayName: Clive Portman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T13:30:18.473Z
Answers.Text: Thanks Jeremy. I'm guessing then that modifying the lineItem value will also preserve other Commerce logic around things like applying discounts, etc? And what about cart actions (changing quantity)... those will use the updated lineItem value also?
Answers.UserDisplayName: Mike
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T21:28:26.430Z
Answers.Text: Yes, the cart is made of of the `linteitem` data structures and all cart operations, calculations etc are done on those - they're entirely separate to the actual products (although there's reference back to the product of course, in case you need to get at fields etc.  When the order is finalised, snapshots of all the data at the time are taken as well.  So yes, barring any bugs, if you change the `lineitem` price all should work as you expect with the adjusted price.
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T23:02:55.253Z
Answers.Text: One last question Jeremy. See my update on the original post. I'm updating the lineItem value but when the Cart page loads is does not reflect that new price. Thoughts? ​Is there a lineItem or cart update method that needs to be called?​
Answers.UserDisplayName: Mike
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T23:07:16.303Z
Answers.Text: Actually, this changed along the way with a new event being offered - it's probably best to use https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem
  
  ...there is an example there to show you how to do it.  I'll update my answer.
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T23:14:49.053Z
Answers.Text: Cool - thanks for all the input - much appreciated. Signing off for the night here but will try tomorrow.
Answers.UserDisplayName: Mike
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T23:18:19.890Z
Answers.Text: Yep I just did a quick plugin here to check and it's working fine, with totals etc as they should be.  Good night!
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-15T02:23:03.420Z
Answers.LastActivityDate: 2017-02-15T23:08:52.817Z
Answers.LastEditDate: 2017-02-15T23:08:52.817Z
Answers.UserDisplayName: Jeremy Daalder
Body: <p>We are considering using Commerce for a site where the company sets hard coded prices for the various regions and countries they sell in. I know Commerce has multi-currency support but pricing is in a primary currency and then you set conversion rates. However our client just sets prices - there's not a consistent conversion rate. So, for example, a US product would be $700, it would be $950 in Canada and 14000 pesos in Mexico.</p>
  
  <p>Is there a way to achieve this with Commerce in a fashion where the client can update these prices in the admin? It's an important requirement for them and we're considering other platforms but thought someone might have some insight specific to Commerce because we do like Craft for other reasons. Thanks!</p>
  
  <p>--- UPDATE ---</p>
  
  <p>Trying this as per the accepted answer and the lineItem price on the Cart page doesn't seem to reflect what gets set in the plugin. My code...</p>
  
  <pre><code>class NewPricingPlugin extends BasePlugin
  {
      function init(){
          craft()-&gt;on('commerce_cart.onBeforeAddToCart', function($event){
  ​​           $line = $event-&gt;params['lineItem'];
  
  ​​ ​          ​NewPricingPlugin::log(​$line['price']​);​ # = $9.00
  ​
  ​           // this sets the lineitem price, but when the cart page
             // loads the price hasn't changed.
  ​           ​$line['price'] = 1000;
  
  ​ ​          ​NewPricingPlugin::log(​$line['price']​);​ # = $1000.00
  ​    ​    });
  ​    ​}
  
      // other plugin methods...
  }
  </code></pre>
  
  <p>​Is there a lineItem or cart update method that needs to be called?​</p>
  
Tags: <plugin-craftcommerce><currency>
Title: Craft Commerce: Hard code different product prices based on currency?
ThreadText: # Craft Commerce: Hard code different product prices based on currency?
  
  (Asked by: username_0 on 2017-01-26)
  
  We are considering using Commerce for a site where the company sets hard coded prices for the various regions and countries they sell in. I know Commerce has multi-currency support but pricing is in a primary currency and then you set conversion rates. However our client just sets prices - there's not a consistent conversion rate. So, for example, a US product would be $700, it would be $950 in Canada and 14000 pesos in Mexico.
  
  Is there a way to achieve this with Commerce in a fashion where the client can update these prices in the admin? It's an important requirement for them and we're considering other platforms but thought someone might have some insight specific to Commerce because we do like Craft for other reasons. Thanks!
  
  --- UPDATE ---
  
  Trying this as per the accepted answer and the lineItem price on the Cart page doesn't seem to reflect what gets set in the plugin. My code...
  
  ```
  class NewPricingPlugin extends BasePlugin
  {
      function init(){
          craft()->on('commerce_cart.onBeforeAddToCart', function($event){
  ​​           $line = $event->params['lineItem'];
  
  ​​ ​          ​NewPricingPlugin::log(​$line['price']​);​ # = $9.00
  ​
  ​           // this sets the lineitem price, but when the cart page
             // loads the price hasn't changed.
  ​           ​$line['price'] = 1000;
  
  ​ ​          ​NewPricingPlugin::log(​$line['price']​);​ # = $1000.00
  ​    ​    });
  ​    ​}
  
      // other plugin methods...
  }
  
  ```
  
  ​Is there a lineItem or cart update method that needs to be called?​
  
  **Tags:** plugin-craftcommerce, currency
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-02-15. Score: 5 | Accepted answer
  
  You can add custom fields to store the 'other' price for your products (and/or variants), like, as you say, a matrix, or probably even a table would do. The fields can then be edited by admins in the back end.
  
  In your templates, you'd selectively display whichever price the particular market needs - this would just be basic template logic.
  
  Then, you'll also need a simple custom plugin that listens to `onPopulateLineItem` and checks which market the customer is in, and modifies the lineItem price accordingly (by retrieving the correct price form the appropriate field). Once the lineItem prices are modified as appropriate, they'll be used for the payments and stored with the order, factored into totals etc.
  
  There is an example of modifying a lineItem in the docs here:
  <https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem>
  
  Unless you have other requirements not mentioned, for someone with Commerce experience, that would be really be quite simple to implement.
  
  (Based on ~ a years work with Commerce and related plugin writing).
  
  > **Comments:**
  > **username_0**: Thanks username_1. I'm guessing then that modifying the lineItem value will also preserve other Commerce logic around things like applying discounts, etc? And what about cart actions (changing quantity)... those will use the updated lineItem value also?  
  > **username_1**: Yes, the cart is made of of the `linteitem` data structures and all cart operations, calculations etc are done on those - they're entirely separate to the actual products (although there's reference back to the product of course, in case you need to get at fields etc.  When the order is finalised, snapshots of all the data at the time are taken as well.  So yes, barring any bugs, if you change the `lineitem` price all should work as you expect with the adjusted price.  
  > **username_0**: One last question username_1. See my update on the original post. I'm updating the lineItem value but when the Cart page loads is does not reflect that new price. Thoughts? ​Is there a lineItem or cart update method that needs to be called?​  
  > **username_1**: Actually, this changed along the way with a new event being offered - it's probably best to use https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem  ...there is an example there to show you how to do it.  I'll update my answer.  
  > **username_0**: Cool - thanks for all the input - much appreciated. Signing off for the night here but will try tomorrow.  
  > **username_1**: Yep I just did a quick plugin here to check and it's working fine, with totals etc as they should be.  Good night!  
  > **username_2**: I created a plugin for this exact same thing: https://github.com/username_2/priceswitcher  
  
  ---
  
  