Question

How can I filter different membership types from Join It to WooCommerce on a Starter Plan?

  • 1 November 2023
  • 3 replies
  • 29 views

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.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

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 ['membershipName', 'email', 'expirationDate']):
return {'error': 'Required keys missing in input data'}

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

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

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

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

output = generate_coupon_settings(input_data)

 

Userlevel 7
Badge +14

@zhgb 

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