Answers.Body: <p>I think you will have to get your hands a bit dirty with this one.</p>
  
  <p>The Calendar Events fieldtype will get you part of the way, but you still need some module code to pull this off.</p>
  
  <p>A suggested approach is:</p>
  
  <ol>
  <li>Create a product type with the <strong>Events</strong> fieldtype</li>
  <li>Create some module code that creates/updates a product + variants for each date, where the inventory is set to <em>n</em>.</li>
  <li>List the events as you would normally do, and pull in the products and its variants with the reverse relationship.</li>
  </ol>
  
  <p>If the available number of tickets is always the same, you could have one field on the event where you enter the number.</p>
  
  <p>If the amount of tickets vary by day, there is probably multiple approaches. Maybe a Matrix field that assumes position of block with quantity field === date in same position/with a date picker, maybe something else.</p>
  
  <p>You can create a example module over at <a href="https://pluginfactory.io" rel="nofollow noreferrer">pluginfactory.io</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-13T14:39:31.133Z
Answers.Text: Awesome thanks @Fred. Ticket availability is the same for every event.
Answers.UserDisplayName: James Greig
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-22T09:46:51.717Z
Answers.Text: Hey, did you get this to work? I need to build almost exactly the same thing and wasn't even aware of the need to limit the tickets for the events until I found this question… damn.
Answers.UserDisplayName: portnull
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-13T14:23:25.663Z
Answers.LastActivityDate: 2019-02-13T14:23:25.663Z
Answers.UserDisplayName: Fred Carlsen
Body: <p>We need to build a ticketing system for venue tours, that happen every week within certain date ranges, and with an option to exclude specific dates from the availability list.</p>
  
  <p>Looking at Solspace Calendar, it offers almost exactly the fields we need for this out of the box: (screenshot below)</p>
  
  <p>But I can't figure out how to either:  </p>
  
  <p>(1) Recreate this setup as fields on a Commerce product . </p>
  
  <p>(2) Create a relationship between a Solspace Calendar event and a Commerce product (that only allows for a certain number of products to be sold for each date in the calendar).  </p>
  
  <p><a href="https://i.sstatic.net/XfjR8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XfjR8.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-11T15:35:02.400Z
Comments.Text: So far I've got this:
  (1) Use Solspace Calendar to define each tour as a repeating event.
  (2) Then query that event list and display a Commerce "Buy product" form for each event occurance, with a hidden options param for the date/time
  (3) This means that the Commerce item has a "tour-date" options param when added to the cart / purchased, which stores the date/time
  
  Then just need something to prevent people purchasing a tour that has already been sold... not sure if querying already-placed orders for these date is madness...
Comments.UserDisplayName: James Greig
Tags: <craft3><events><plugin-craftcommerce2><plugin-solspacecalendar>
Title: Selling tickets to repeating events with Commerce (and Solspace Calendar?)
ThreadText: # Selling tickets to repeating events with Commerce (and Solspace Calendar?)
  
  (Asked by: username_0 on 2019-02-11)
  
  We need to build a ticketing system for venue tours, that happen every week within certain date ranges, and with an option to exclude specific dates from the availability list.
  
  Looking at Solspace Calendar, it offers almost exactly the fields we need for this out of the box: (screenshot below)
  
  But I can't figure out how to either:
  
  (1) Recreate this setup as fields on a Commerce product .
  
  (2) Create a relationship between a Solspace Calendar event and a Commerce product (that only allows for a certain number of products to be sold for each date in the calendar).
  
  [![enter image description here](https://i.sstatic.net/XfjR8.png)](https://i.sstatic.net/XfjR8.png)
  
  **Tags:** craft3, events, plugin-craftcommerce2, plugin-solspacecalendar
  
  > **Comments:**
  > **username_0**: So far I've got this: (1) Use Solspace Calendar to define each tour as a repeating event. (2) Then query that event list and display a Commerce "Buy product" form for each event occurance, with a hidden options param for the date/time (3) This means that the Commerce item has a "tour-date" options param when added to the cart / purchased, which stores the date/time  Then just need something to prevent people purchasing a tour that has already been sold... not sure if querying already-placed orders for these date is madness...  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-13. Score: 2 | Accepted answer
  
  I think you will have to get your hands a bit dirty with this one.
  
  The Calendar Events fieldtype will get you part of the way, but you still need some module code to pull this off.
  
  A suggested approach is:
  
  1. Create a product type with the **Events** fieldtype
  2. Create some module code that creates/updates a product + variants for each date, where the inventory is set to *n*.
  3. List the events as you would normally do, and pull in the products and its variants with the reverse relationship.
  
  If the available number of tickets is always the same, you could have one field on the event where you enter the number.
  
  If the amount of tickets vary by day, there is probably multiple approaches. Maybe a Matrix field that assumes position of block with quantity field === date in same position/with a date picker, maybe something else.
  
  You can create a example module over at [pluginfactory.io](https://pluginfactory.io)
  
  > **Comments:**
  > **username_0**: Awesome thanks @username_1. Ticket availability is the same for every event.  
  > **username_2**: Hey, did you get this to work? I need to build almost exactly the same thing and wasn't even aware of the need to limit the tickets for the events until I found this question… damn.  
  
  ---
  
  