shopifyzapier

Triggering Zapier on new Shopify order containing a specific product


I have a simple Zap that is triggered on a Shopify New Order (with line details) and then creates a new account in a system called Trainerize. Works perfectly, but it is triggered by ANY new Shopify order. I need to trigger the Zap for a specific product in the Shopify order. Is this possible in Zapier, and how would I go about it? It seems you can't talk to Zapier support unless you have a plan, and I don't want a plan if it is not possible!


Solution

  • Yes, it is possible. The exact implementation depends on how you want to identify the specific product. I am listing 2 possible ways

    In case, the criteria to identify product is quite simple, you can use Filter by Zap. For example, if you want to identify product by product Id, you can just add a Filter by Zap and add the following conditions.

    Line Items Product ID | Text Contains | Your Product ID - 12345
    

    Filter by Zap

    If you have some complex matching condition for your Product, you can also use Code by Zapier to run JavaScript code. To do so, pass the required data as input to code and return output that can be used later to see if the match was found. A simple example that gets LineItems productIds as input.

    const TARGET_PRODUCT_ID = 12345;
    
    const productIds = inputData.productIds.split(",");
    
    output = {targetProductFound: false};
    
    productIds.forEach(id => {
       // Add more conditions if needed
       if(Number(id) === TARGET_PRODUCT_ID){
         output.targetProductFound = true;
       }
    });
    
    return output
    

    Then use Filter to proceed or abort.

    enter image description here