Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Integrate Loyalty Apps with MobiLoud

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 Begin

Before we jump into the Flow creation, make sure you have the MobiLoud Shopify App installed with the tags configured as follows:

Overview

This Flow action will:

  • Check if a customer has a specific tag
  • Return a boolean result that can be used in Flow conditions

Setup Steps

1. Create the Flow Action

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:

2. Input Schema (GraphQL)

query {  
	order {    
		id    
		customer {
			id      
			tags    
		}  
	}
}

Note: If your Flow is triggered by a customer event (not an order), use:

query {  
	customer {    
    	id    
        tags  
    }
}

3. Output Schema (SDL)

type Output {  
	hasCanvasTag: Boolean!
}

4. JavaScript Code

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:

Using the Result

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: