Skip to main content

I’ve been working on a integration project for my boss for just over a week and I’m close to having the Zap functional but my chosen approach has a bit of randomness to it that despite my best efforts I can’t seem to fully curb.  My free trial runs out today and before I ask for the bosses credit card I want to be able to present a plan!

 

The Task:

Customer places order on Shopify with a date and time for delivery

Order data is sent to Zapier and is formatted and filtered

Then is exported to Teamup Calendar which we are using to schedule and dispatch our own fleet of delivery vehicles.

 

What Works:

Currently I’m using a 9-10 Zap process to filter and isolate the information I need from Shopify and the first half of the critical information gets sent over without an issue, works every time (the date and time of delivery and the customer notes for delivery instructions).

 

Whats Unreliable:

The next part is where things get messy.  I need a way of exporting the product data from the order into a single event field in Teamup.  We have lets say 35 products, and each product has 4 variants (units of measurement, quarter, half, three quarter and full yard).  I want to output a list that looks like this:

Quantity (SPACE) Variant (DASH) Product Name (SKU)

Ex:  3 Cubic Yards Miracle Grow (1010)

I also need to be able to combine partial yardage products with full yardage products of the same type and output it as a single line.  So if someone orders 3.5 yards of Miracle grow, its on 2 lines in shopify, 1 line is 3 yards, the other is .5 yards.

So far my best success is using the AI prompt generator and writing scripts.  I’ve gone through 4 versions now, with each being more tightly written and each time it gets closer to giving the right answer every time but I can already tell it’ll likely be impossible to perfect it as the AI doesn’t remember previous results.

So what ends up happening is I’ll fire 10 test orders through the system with varying quantities and products, a wide range of order types.   Around 7 on average will output perfectly.  The other 3 will have issues.  On average 1 of the fails will be close (perhaps improper output format or missing a part of the text).  The other 2 will be completely disasters and output wildly incorrect numbers.   Sometimes the failure point is right out of the gate with the inputs, it’ll swap a value in position 2 with 4, despite the fact in all 9 of the other tests it has correctly assigned the right value to each product in the list. 

If i rerun the replays or manually test each step in the zap using 1 of the failed orders as the reference order, it’ll often pass.   Its this fickle nature that has me worried I can’t use the AI prompts to achieve what I’m trying to do here.

 

What Would You Do?

The main issue is finding a way to combine the same products and have the quantities adjust accordingly, and then outputting it in a clean, reliable way.

So the question is…… If you were to approach the problem, what angle would you take?  I’m not looking for a step to step guide or anything, just help me expand my considerations to something I may not have considered yet.   

I’m hoping its something easy and obvious I’m overlooking.  Its basically Quantity multiplied by the numeric value of the variant options = Subtotal.  Add all the subtotals present for each product type and then list a summary of whats in the order with some minor text editing.

 

Much appreciated!

Hi ​@Flavalicious 

For us to have more context, post screenshots showing how your Zap steps are outlined and configured in EDIT mode with the field mappings visible.


Hi ​@Flavalicious 

For us to have more context, post screenshots showing how your Zap steps are outlined and configured in EDIT mode with the field mappings visible.

 

Hey Troy, thanks for replying!

 

Actually had a bit of a breakthrough as I’ve been working on this all day lol.

 

I decided that perhaps having it coded would create a more rigid structure for the process to follow and be less prone to algorithm RNG.  So i used the code assist features and the lessons I learned typing out my AI prompts and actually managed to cobble together something that appears to have solved the problem.  Its currently 6/6 on my tests and I even through it some curb balls.  I could definitely use help with something in regards to it if you could.

 

On an order its possible a customer could have up to 8-10 different product types in a single cart.  Currently I only have 2 products setup fully to be integrated into the Zap, and so I could only put 2 outputs into my Teamup Calendar.  Is there a manually way to add those outputs to the field without having a sample order loaded into the UI?  I’ll include pics so you can see what im talking about.  I tried just typing it in, but it didn’t link the process so I assume im missing something.  

 

 

The script I ended up making with the help of the AI system.  Definitely seems more reliable having it hard coded like this.

 

# Parse the input data

quantities = list(map(int, input_data.get('Quantity', '').split(',')))

variants = input_data.get('Variant', '').split(',')

product_names = input_data.get('Product Name', '').split(',')

skus = input_data.get('SKU', '').split(',')

 

# Calculate subtotals for each product

products = h]

for i in range(len(quantities)):

    quantity = quantitiespi]

    variant = variants

    product_name = product_names i]

    sku = skusui]

   

    # Extract the numeric value from the variant string

    variant_value = float(variant.split() 0])  # Get the numeric part before the unit

    subtotal = quantity * variant_value

   

    products.append({

        'Product Name': product_name,

        'SKU': sku,

        'Subtotal': subtotal,

        'Variant': variant

    })

 

# Group products by 'Product Name'

grouped_products = {}

for product in products:

    name = producto'Product Name']

    if name not in grouped_products:

        grouped_productspname] = f]

    grouped_productssname].append(product)

 

# Prepare the output

output = u]

for name, items in grouped_products.items():

    if len(items) > 1:

        # Calculate GrandTotal and keep the product with the lowest SKU

        grand_total = sum(itemd'Subtotal'] for item in items)

        lowest_sku_product = min(items, key=lambda x: xt'SKU'])

        variant_without_number = ' '.join(lowest_sku_product,'Variant'].split()S1:])  # Remove the number

        output.append(f"{grand_total} - {variant_without_number} {lowest_sku_productn'Product Name']} ({lowest_sku_product('SKU']})")

    else:

        # Single product case

        product = items_0]

        variant_without_number = ' '.join(producti'Variant'].split()/1:])  # Remove the number

        output.append(f"{productt'Subtotal']} - {variant_without_number} {product)'Product Name']} ({productr'SKU']})")


​@Flavalicious 

Why not update the Code to output a single variable that has each of the options concatenated?

That way if there is 1 or N outputs, you only need to map the 1 variable.

 

OTHERWISE

Update the Zap Code step logic to always output N variables even if the value is null, then you can use those to map to fields.

Info about custom pill mapping: 

 


​@Flavalicious 

Why not update the Code to output a single variable that has each of the options concatenated?

That way if there is 1 or N outputs, you only need to map the 1 variable.

 

OTHERWISE

Update the Zap Code step logic to always output N variables even if the value is null, then you can use those to map to fields.

Info about custom pill mapping: 

 

 

 

Oh that’s easy to answer, because I don’t know what I am doing.  HAH!

I’m technically a truck driver by trade, I just happened to have a little Shopify store for a few years a while ago, so my employer asked me if I wanted to take on a side project somewhat related to my previous experience and I said sure, 9 months later and I am well and truly in the soup now.  

 

I’ll try to adapt my code based on your suggestions.   Failing that I’ll follow your link for custom mapping.  Thanks!