This guide shows you how to create a custom Shopify Flow that can be used to integrate MobiLoud with your preferred loyalty program in Shopify.
The idea is simple, we will check if the user has a specific tag assigned to his Shopify profile once an order is placed, and if so, we will grant him extra points.
The tag is only assigned to his profile when he is using the app, so this means that if our check passes, the user placed the order while in the app.
Before we jump into the Flow creation, make sure you have the MobiLoud Shopify App installed with the tags configured as follows:
This Flow action will:
Go to Apps > Flow in your Shopify admin
Create a new Flow or edit an existing one, add a Run code action.
Configure the code action as follows:
query {
order {
id
customer {
id
tags
}
}
}
Note: If your Flow is triggered by a customer event (not an order), use:
query {
customer {
id
tags
}
}
type Output {
hasCanvasTag: Boolean!
}
export default function main(input) {
// Get customer from order (adjust path based on your trigger)
const customer = input.order?.customer;
const customerTags = customer?.tags || [];
// Tag to check for (case insensitive)
const targetTag = 'App User'; // Change this to your desired tag
// Check if customer has the target tag (case insensitive)
const hasTargetTag = customerTags.some(tag =>
tag.toLowerCase() === targetTag.toLowerCase()
);
// Return a plain object
const result = {
hasCanvasTag: hasTargetTag
};
return result;
}
Your "Run Code" action will look like this:
After the "Run Code" action is created, you can use the result in Flow conditions:
Add a Condition action after your code action, then search for the "Run Code" step you just created:
Select the "hasCanvasTag" variable:
Adjust the condition to "Equal to" "true", as follows:
The idea is to check if the user has the "App User" tag in his profile, and if that is the case, proceed with adding the extra points to his account.
The next steps will vary depending on your preferred loyalty program, but here are some guides from the most popular ones to assist with the final steps of the setup: