Dynamic Product Price without Creating Variant

We are building an app for dynamic pricing. The stores have many dynamic options for each products. And price of the product depends on chosen value of the options. Each product has more than a dozen of options.

Previously it was done by -

  • Create a variant of the product [based on user selections]
  • Pass the variant id and quantity to “cart/add.js” endpoint.

The problem arising is, there will be more than 100 thousands variant based on randomness of the selected options.

After researching I have found that, we should use “cart transform” function.

Is there any other good alternatives or we should go for cart transform function.

Cart transform is probably your best bet, but you’ll most likely require the update operation, which requires Plus.

Then we cannot go with that solution. Need to find other alternatives.

Hey @illusionist3886, totally understand the constraint there.

Another option to look into would be Discount Functions. If your dynamic pricing can be expressed as a discount off a base price, you could set the product at the highest possible price and use a discount function to calculate the reduction based on the customer’s selections (stored as line item properties or cart attributes). Discount Functions are available on any plan through public apps distributed via the App Store, though custom apps with Functions do still require Plus. The main note here is it only works for price reductions, not increases above the base price.

There’s a bit more info on here:

Hope this helps.

1 Like