This guide will quickly walk you through the process of setting up an automation to send reminders, such as discount codes, to customers with abandoned carts.
What does it do?
Customers who leave the checkout before submitting an order are retargeted to encourage them to complete their purchase, thus reducing abandoned cart checkouts. This automation automatically sends messages to customers with abandoned carts, including a link to their specific unfinished checkout and a discount code that is automatically applied.
In this guide, we will quickly walk you through the process of setting up an automation that allows you to send out reminders with discount codes to customers with abandoned cart checkouts:
- Create WhatsApp template
- Build Zapier automation
1. Create Whatsapp template
Step 1.1: Create new WhatsApp Template
Log in to your Superchat account and navigate to Settings > Templates > WhatsApp Templates > New Template. Here, you can either create your own template or explore popular templates.
Example Message:
Hi,
we noticed you left something in your cart so we wanted to give you a small gift! 🎁🙂 Complete your purchase within 24h and use the code SUMMER10 to enjoy a 10% discount on your order.
Click below to get back to your cart! If you have any questions, feel free to reach out – we’re happy to help! 😊
Your Superchat Team 🚀
Step 1.2: Create dynamic link
Create a dynamic link that includes your base URL. The URL extension will later include your discount code.
2. Build Zapier automation
This automation is triggered when a new abandoned cart checkout is detected. It extracts the customer’s abandoned cart URL, adds the discount code, and ensures the phone number is correctly formatted before sending a WhatsApp template via Superchat.
Step 2.1: Define trigger
Choose a trigger that detects abandoned cart checkouts.
Step 2.2: Run python
Select a “Code by Zapier” Element as your next step and choose 'Run python' as the option. Ensure the InputData matches “data” as shown in the code.
data = input_data.get('data', '')
modified_data = data[WRITE THE NUMBER OF LETTERS THAT HAVE TO BE REMOVED HERE:]
output = {'modified_data': modified_data}
Step 2.2 a: Remove URL
This code removes the front part of the abandoned checkout URL, for example, removing "https://superchat.de/" from the abandoned cart URL: "https://superchat.de/32646237878/checkouts/az". Therefore, you need to count how many leading characters come before the custom string relevant to the abandoned cart URL.
Step 2.2 b: Count characters
Count how many characters your main website URL contains. Typically, your website URL should be in this format: "https://yourwebsite.com/". You only need the trailing part of the URL (e.g., from "https://yourwebsite.com/32646237878/checkouts/az", you only need the trailing part "32646237878/checkouts/az"). The number of characters before this part of the URL will be removed by the code.
Step 2.3: Run python
Add another “Code by Zapier” Element and run it as 'Run Python' action. Then choose the output of the previous Python step as your input data.
- If you haven't created a discount code for your e-commerce store yet, now is the perfect time to do so. Once you've created it, you can change the label in the code. Instead of "SUMMER10," you simply enter your code.
url = input_data.get('Abandoned Cart String', '')
if '?' in url:
modified_url = f"{url}&discount=SUMMER10"
else:
modified_url = f"{url}?discount=SUMMER10"
output = {'modified_url': modified_url}
Step 2.4: Phone numbers for different country codes
Use a “Formatter by Zapier” Element to format for different country codes.
Step 2.4: Two paths
Now, the automation is split into two different paths to handle various phone number formats (e.g., numbers starting with 0, 00, or +). Select the 'Paths' element to divide the automation into two paths.
Path A:
Step 2.6: Run python
Continue Path A by selecting a “Code by Zapier” Element and run it as 'Run Python' action as your next step.
input_string = inputData['phone']
if input_string.startswith("00"):
output_string = input_string[2:]
elif input_string.startswith("0"):
output_string = input_string[1:]
else:
output_string = input_string
return {"output": output_string}
2.6 a: Choose phone number
Select the phone number as your input data
2.6 b: Inputdata variable
Enter the code and make sure the inputData is “phone”.
2.7: Run python
Add another “Code by Zapier” Element and run it as 'Run Python' as your next step**
input_text = input_data.get('rp', '')
utilities_output = input_data.get('utilities_node_output', '')
if input_text.startswith('+'):
output = input_text
else:
output = utilities_output + input_text
return {"output": output}
Step 2.7 a: Output
Select the output from the 5th Python step and the output of step 2 as your input data.
Step 2.7 b: InputData
Ensure the InputData names match those used in the code.
Step 2.8: Send WhatsApp template
Select a “Send WhatsApp Template” Superchat action as your next step
Path B:
Step 2.9: Send WhatsApp template
Continue Path B by selecting a “Send WhatsApp Template” Superchat action.
Once you’ve completed these steps, your automation is ready. Keep in mind there may be a delay between the abandoned cart detection and when the message is sent.
With this automation, you can now automatically win back lost customers and boost your conversion rate.