Shopify Return Trigger - How to calculate which product was refunded and how much
Use Case:
I am connecting Shopify to my Notion Page where I manage all orders. Every order is added there for me to track, basically when someone refunds an order, I wanna find the order and product, and then mark it as refunded and update the amount to the refunded amount.
Problem: I set the refund trigger on Zapier but it only shows the return id and transaction details which seems confusing, most orders would have multiple products, I would like to know which product was refunded and how much for each products.
Here’s the values from Shopifys Return trigger
Page 1 / 1
Here’s how to set up a Zap in Zapier to identify which product was refunded and the refund amount for each product in Shopify.
Trigger: Refund Created in Shopify
App & Event: Choose Shopify as the app and "Refund Created" as the trigger event.
Set Up Trigger: Connect your Shopify account and test the trigger to ensure it captures refund data.
Action: Get Order Data
App & Event: Choose Shopify as the app and "Get Order Data" as the action event.
Set Up Action: Map the fields to pull the relevant order details, including line items.
Action: Formatter (Text > Extract)
App & Event: Choose "Formatter by Zapier" as the app and "Text" as the action event. Select "Extract" for the operation.
Set Up Action: Configure the Formatter to extract product IDs and refund amounts from the order data.
Action: Loop Through Each Product (Using Looping by Zapier)
App & Event: Choose "Looping by Zapier" as the app and "Create Loop From Text" as the action event.
Set Up Action: Split the extracted product details (IDs and amounts) into individual items to create a loop.
Action: Find Record in Notion
App & Event: Choose Notion as the app and "Find Record" as the action event.
Set Up Action: Use the product ID from the loop to find the corresponding record in your Notion database.
Action: Update Record in Notion
App & Event: Choose Notion as the app and "Update Record" as the action event.
Set Up Action: Map the fields to update the product status to "Refunded" and update the refund amount.
Example Workflow
Shopify Trigger: Refund Created
Shopify Action: Get Order Data
Formatter: Extract Product IDs and Refund Amounts
Looping by Zapier: Create Loop From Text
Notion Action: Find Record (using Product IDs)
Notion Action: Update Record (mark as refunded and update refund amount)
This workflow should help you track refunded products and their amounts
Action: Get Order Data
App & Event: Choose Shopify as the app and "Get Order Data" as the action event.
Set Up Action: Map the fields to pull the relevant order details, including line items.
Action: Formatter (Text > Extract)
App & Event: Choose "Formatter by Zapier" as the app and "Text" as the action event. Select "Extract" for the operation.
Set Up Action: Configure the Formatter to extract product IDs and refund amounts from the order data.
Action: Loop Through Each Product (Using Looping by Zapier)
App & Event: Choose "Looping by Zapier" as the app and "Create Loop From Text" as the action event.
Set Up Action: Split the extracted product details (IDs and amounts) into individual items to create a loop.
Thanks for this, I tried this but the “Get Order Data” only shows the Line Item Products and the Refunded as 2 separate objects, there’s literally nothing in common between them that I could relate and map with to find the exact amount.
Or is there something i am missing?
For ex:
The above mentioned screenshot shows the refund object
The above mentioned shows the Line Item/Product Object
There’s no field I can use to map the right line item from the refund object
Hi there, @Fahad.S!
I had a look at the API documentation for Shopify I’d have thought that the New Refund trigger should contain the ID for the item being refunded within refund_line_items section here:
But it’s not super clear from their API documentation whether that ID is definitely the ID for the specific product.
Does the ID highlighted in the screenshot below match the id of a product in your Shopify store?