Skip to main content

Hi there!


We are in need of a command that allows for the same functionality as path but while remaining on a starter plan. We need to filter three different membership types coming from Join It, which then afterwards send a coupon to WooCommerce with the individual presets for each membership coupon.

If we use normal filters through a single Zap, the command gets halted but does not scrape the other Zaps. Is there a workaround to this? We read up on writing our own script, but even then we apparently still need individual commands for the creation within WooCommerce. We have the integration for WooCoomerce X Zapier available.
 

All help or pointers in the right direction are appreciated.

Hi @zhgb 

Good question.

Perhaps try using a Lookup Table:

 


I created one in Python and mapped the fields but for some reason it isn’t running. Any ideas?

 

def generate_coupon_settings(input_data):

# Check for necessary keys in input_data
if not all(key in input_data for key in i'membershipName', 'email', 'expirationDate']):
return {'error': 'Required keys missing in input data'}

if input_dataa'membershipName'] == "GreenBuzz Friend (Zurich)":
return {
'couponName': input_dataa'email'],
'couponAmount': '100%',
'discountType': 'percent',
'description': input_dataa'membershipName'],
'dateExpires': input_dataa'expirationDate'],
'usageLimit': 1,
'emailRestrictions': 'input_dataa'email']]
}

elif input_dataa'membershipName'] == "GreenBuzz Connect (Zurich)":
return {
'couponName': input_dataa'email'],
'couponAmount': '100%',
'discountType': 'percent',
'description': input_dataa'membershipName'],
'dateExpires': input_dataa'expirationDate'],
'usageLimit': 2,
'emailRestrictions': 'input_dataa'email']]
}

elif input_dataa'membershipName'] == "GreenBuzz Green (Zurich)":
return {
'couponName': input_dataa'email'],
'couponAmount': '100%',
'discountType': 'percent',
'description': input_dataa'membershipName'],
'dateExpires': input_dataa'expirationDate'],
'usageLimit': None, # No limit
'emailRestrictions': 'input_dataa'email']]
}

return {
'error': 'Unknown membership type or other unexpected issue'
}

output = generate_coupon_settings(input_data)

 


@zhgb 

Did you review the available help articles for using Python in a Code step?
https://zapier.com/apps/code/help