How to dynamically create a product variant with ajax api

Topic summary

Goal: Build a bundle product on Shopify from a user’s selections across multiple products/variants and add it to the cart via the Ajax API.

Scenario:

  • Products A, B, C each priced at 100 with selected sizes (10, 12, 15).
  • User selects one variant from each; total intended price: 300.

Core question: Can a new variant (i.e., a specific option combination within a product) be created dynamically with the aggregated price (300) and then added to the cart using the /cart/add.js endpoint (Shopify Ajax API)?

Desired cart item structure:

  • Title: New variant title representing the bundle.
  • Line item properties listing selected components (Product A - Size 10, Product B - Size 12, Product C - Size 15).
  • Price: 300.

Technical notes: Mentions looping through selections to build an array of items; intends to use /cart/add.js to post the new item.

Attachments: Includes an illustrative image central to understanding the intended cart presentation.

Status: Open question; no confirmed method or resolution provided yet.

Summarized with AI on February 5. AI used: gpt-5.

I need to create a bundle product based on user’s selection over multiple variants/options. So let’s imagine the next scenario:

I have:

Product A - Size 10 - Price 100

Product B - Size 12 - Price 100

Product C - Size 15 - Price 100

User selects:

Product A - Size 10

Product B - Size 12

Product C - Size 15

(At this point I have loop through the user’s selections, and created and array of items with this data)

My question is:

Is it possible to dynamically create a new variant with the new total price (300) And add this new variant to the cart with “/cart/add.js” post call?

So new variant in cart would look something like:

New variant title

properties:

Product A - Size 10

Product B - Size 12

Product C - Size 15

Price: 300

Thanks in advance