<p>I don't think there is a way to do this from the back end data entry point of view currently - that is, right now, the price field is required, and indeed is required to be a number.  You can't use e.g. the value of another field in there (in which case you could have used e.g. a global or something to store a single record of the price elsewhere).</p>

<p>The other solution would be to deal with it via a plugin - you could listen to <code>https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem</code> and intercept this product, setting the price for the lineItem in there.  You could make a setting field in your plugin to store the actual price so there was a UI based way of changing it globally easily.  However, you'd still have to enter <em>some</em> price in the product when entering the product, something token like 0.01 perhaps.  Not perfect from a UI point of view and easily  misunderstood by anyone coming new to the back end.</p>

<p>Ideally, and it might we worth making a feature request to P &amp; T for this - a price field that can parse twig and pulls values from elsewhere - this could certainly be <em>very</em> handy.</p>

<p>Another option would be to write a product importer and deal with the data entry that way - so that the price is set at the time of import of the data.  There's a gist that would get you started with here - <a href="https://gist.github.com/lukeholder/bbff8caef82078fc76e4">https://gist.github.com/lukeholder/bbff8caef82078fc76e4</a></p>

<p>All said and done, though, this might be just one of those instances where you have to just deal with the data entry (at the moment) - it all depends of course whether the extra work/maintenance of an importer or plugin is worth doing (which all depends on how many products you're talking about and perhaps how often the price would change).</p>

CC BY-SA 3.0
2016-07-19T00:47:50.933Z
2016-07-19T00:47:50.933Z
Jeremy Daalder
<p>I have a Product Type where every product has the same price. What are some good ways to avoid having to enter this same price for every product?</p>

<plugin-craftcommerce>
Default price in Craft Commerce
# Default price in Craft Commerce

(Asked by: username_0 on 2016-07-18)

I have a Product Type where every product has the same price. What are some good ways to avoid having to enter this same price for every product?

**Tags:** plugin-craftcommerce

---

## 1 answers

### Answer by username_1 on 2016-07-19. Score: 4 | Accepted answer

I don't think there is a way to do this from the back end data entry point of view currently - that is, right now, the price field is required, and indeed is required to be a number. You can't use e.g. the value of another field in there (in which case you could have used e.g. a global or something to store a single record of the price elsewhere).

The other solution would be to deal with it via a plugin - you could listen to `https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem` and intercept this product, setting the price for the lineItem in there. You could make a setting field in your plugin to store the actual price so there was a UI based way of changing it globally easily. However, you'd still have to enter *some* price in the product when entering the product, something token like 0.01 perhaps. Not perfect from a UI point of view and easily misunderstood by anyone coming new to the back end.

Ideally, and it might we worth making a feature request to P & T for this - a price field that can parse twig and pulls values from elsewhere - this could certainly be *very* handy.

Another option would be to write a product importer and deal with the data entry that way - so that the price is set at the time of import of the data. There's a gist that would get you started with here - <https://gist.github.com/lukeholder/bbff8caef82078fc76e4>

All said and done, though, this might be just one of those instances where you have to just deal with the data entry (at the moment) - it all depends of course whether the extra work/maintenance of an importer or plugin is worth doing (which all depends on how many products you're talking about and perhaps how often the price would change).


---

