Dynamic bundle logic

Boyadzhiev
Tourist
5 0 0

Hi all,

In our shop, we are using quantity and combo bundles and at the moment they are applied as hard-coded values via Shopify Script Editor.

With the business growth, the number of bundles is growing too. So I'm looking for a way to automate this process.

The current downsides:
- The Scrip Editor doesn't allow connection to any external data source (API, file, database)
- I didn't find a way to update the script itself (let say via Admin API for example)

So I need help to find a way to replicate the Script Editor functionality on cart change events but controlled by my system.

I checked:
- Shopify Ajax Cart API - it can change only product quantity and it is not safe to change prices
- Webhooks - only one direction, send events
- A private app - don't have access to the current customer session and respectively to the cart 
- A custom app - I couldn't find how to manipulate the current customer cart 

I saw a few third-party apps working with bundles but I don't understand how they apply the logic to the cart.

So, please share, if you have any idea how to use dynamic bundle definition in any way. The tech stack doesn't matter.

 

0 Likes
samthewebb
Shopify Partner
24 3 2

There's probably a solution you can use combining Script Editor, line item properties and product tags to solve this in a way that prevents you from having to hardcode the products in the script and prevents Shopify savvy people from being able to game the system.

Spoken script logic would be something like:

If customer has X or more products with the line item property blah in cart

  For each line item that's associated product also has the tag other-blah

    Discount line item by XX%

The bolded values would be the only values you need to hardcode into the script and you could set those as variables right at the top of the script to make them easy to update in the future.

Sam Webb
https://samthewebb.com
sam@samthewebb.com
0 Likes
Boyadzhiev
Tourist
5 0 0

Thanks Sam,
but exactly this hardcode data is the problem.

We want to have multiple combinations and we don't want to update manually on each change or adding a new product.

0 Likes