Add a line item to a Cart

Ensure you have on hand an event ID so you can add that as a product to the cart

mutation addItemToCart($cartId: ID!, $eventId: ID!) {
  cart {
      addLineItem(input: {
          cartId: $cartId,
          cartLineItem: {
              quantity: 1,
              productOptionId: $eventId,
              learners: {
                  newLearners: []
              }
          }
      }) {
          errors { label value message }
          cart {
              id
              items {
                  id
                  quantity
                  subTotalAmount
                  unitAmount
                  totalAmount
              }
          }
      }
  }
}

Will result in:

{
    "data": {
        "cart": {
            "addLineItem": {
                "errors": [],
                "cart": {
                    "id": "T3Bwb3J0dW5pdHk6OTQ4",
                    "items": [
                        {
                          "id": "T3Bwb3J0dW5pdHlJbnRlcmVzdDo5MTQ=", # < -- COPY THIS!
                          "quantity": 1,
                          "subTotalAmount": "150.00",
                          "unitAmount": "150.00",
                          "totalAmount": "180.00"
                        }
                    ]
                }
            }
        }
    }
}

Take note of the item id, this is an opportunity interest id and will be used to tie a learner to the event.