<p>Craft Commerce support has answered to my question :</p>

<blockquote>
  <p>Currently Craft Commerce can not have a stock counter that covers more
  than one variant. The default product+variant system is not designed
  for tickets. We hope to see a ticket 'Purchasable' plugin in the
  future. You can request this feature <a href="http://feedback.craftcms.com/forums/295386-commerce/filters/top" rel="nofollow">here</a>.</p>
  
  <p>If you have some plugin experience, you could get around this issue
  you described with a plugin that updates the stock of other variants
  when someone purchases a variant using the onOrderVariant event. You
  would likely need to know the relationships between SKUs for the
  different variants within your plugin, and deduct the stock from the
  related variants like so:</p>

<pre><code>craft()-&gt;db-&gt;createCommand()-&gt;update('commerce_variants',
  ['stock' =&gt; new \CDbExpression('stock - :qty', [':qty' =&gt; $theQty ])],
  'id = :variantId',
  [':variantId' =&gt; $variantId]);
</code></pre>
  
  <p>Check out the <a href="https://github.com/pixelandtonic/CommerceStockNotifier/blob/master/commercestocknotifier/CommerceStockNotifierPlugin.php" rel="nofollow">Stock Notifier plugin</a> as it matches closely to the
  events you would need to use.</p>
</blockquote>

CC BY-SA 3.0
2016-06-22T07:42:14.823Z
2016-06-22T17:23:06.883Z
2016-06-22T17:23:06.883Z
Romain P.
<p>I am looking for a solution that would allow me to sell events tickets within Craft. I'm am currently making a prototype with Craft Commerce plugin for this project, but I am already facing a major problem.</p>

<p>When creating a new product, I can set a ticket price + a total number of tickets available at this price. When using variants, I can define multiple tickets + a total of available tickets under each price. But it does not seems possible to synchronize a total number of available tickets with different price options (full price and other at reduced fare).</p>

<p>How can I do ? Is it possible to set the total number of tickets available outside of variants, such as the variants would be only used to set the price ?</p>

<plugins><plugin-craftcommerce><events><ecommerce>
Craft Commerce: How to manage different prices with one product?
# Craft Commerce: How to manage different prices with one product?

(Asked by: username_0 on 2016-06-20)

I am looking for a solution that would allow me to sell events tickets within Craft. I'm am currently making a prototype with Craft Commerce plugin for this project, but I am already facing a major problem.

When creating a new product, I can set a ticket price + a total number of tickets available at this price. When using variants, I can define multiple tickets + a total of available tickets under each price. But it does not seems possible to synchronize a total number of available tickets with different price options (full price and other at reduced fare).

How can I do ? Is it possible to set the total number of tickets available outside of variants, such as the variants would be only used to set the price ?

**Tags:** plugins, plugin-craftcommerce, events, ecommerce


---

## 1 answers

### Answer by username_0 on 2016-06-22. Score: 2

Craft Commerce support has answered to my question :

Currently Craft Commerce can not have a stock counter that covers more
  than one variant. The default product+variant system is not designed
  for tickets. We hope to see a ticket 'Purchasable' plugin in the
  future. You can request this feature here.
If you have some plugin experience, you could get around this issue
  you described with a plugin that updates the stock of other variants
  when someone purchases a variant using the onOrderVariant event. You
  would likely need to know the relationships between SKUs for the
  different variants within your plugin, and deduct the stock from the
  related variants like so:
craft()->db->createCommand()->update('commerce_variants',
  ['stock' => new \CDbExpression('stock - :qty', [':qty' => $theQty ])],
  'id = :variantId',
  [':variantId' => $variantId]);

Check out the Stock Notifier plugin as it matches closely to the
  events you would need to use.


---

