Using either the Order Editing API or Draft Orders, you can add a custom line item to the cart:(https://shopify.dev/tutorials/edit-an-existing-order-with-admin-api#add-a-custom-line-item).
Custom line items are items that can be charged for, but are not tied to an actual product (i.e. they don't have a variant/product ID).
Is there any way to add such items to the cart from the front end of the store?
Elias here with Shopify Support. Thank you for reaching out.
I understand you’re looking to add custom line items, which aren’t associated with your products, but can be charged for on the storefront. While you can add custom fields to capture information from your customers, it’s not possible to add a fee to this without creating them as a form of product or variant.
Some merchants have been able to add a gift-wrap option to their cart and change the wording for gift-wrap to their add-on. That said, I don’t have enough information about your add-on to determine if this is a workable solution for your store.
Alternatively, you can use a third-party app that has the function to create options for your products and add costs, this doesn’t require creating a variant and the options can be different for each product. I’ve handpicked a couple of apps that can create options and associate a cost for those options for you to try:
If you need any assistance with these apps, you can always reach out to the developers directly through the contact information found in the Support section of the app’s page.
Let me know if this is what you’re looking for? If you have any other questions on options, don’t hesitate to let me know in this thread!