How To Connect FTP Inventory Feed To Update Shopify Products

Today, we’ll introduce you to a lesser-known yet powerful technique to manage your Shopify product inventory efficiently: updating product inventory using FTP files and leveraging FTP inventory feeds. You may be familiar with FTP (File Transfer Protocol) for transferring files, but did you know it can also be a game-changer for inventory management in your Shopify store? This method can save you hours of manual work and reduce the likelihood of human error, which is invaluable for busy ecommerce professionals like you.

In this blog post, we will walk you through the process of updating your Shopify product inventory using FTP by MESA, from setting up the necessary workflow to automating the entire process.

By the end of this tutorial, you’ll have another valuable workflow in your arsenal to keep your Shopify store’s inventory levels running smoothly and accurately.

Let’s dive in!

Benefits of using FTP to manage product inventory

Let’s explore the most compelling advantages that will make a significant impact on your store’s operations:

Time and Effort Savings: By automating product inventory updates using FTP files, you can eliminate the need for manual data entry and reduce the time spent on routine tasks. This frees up more time for you to focus on more strategic aspects of your business.

Reduced Human Error: Manual inventory updates can be prone to human error, such as typos or incorrect data input. By automating the process using FTP inventory feeds, you can minimize the possibility of mistakes and ensure accurate inventory data is always maintained in your Shopify store.

Seamless Integration: FTP is a widely used and supported file transfer protocol, which means you can easily integrate FTP inventory feeds with other software systems, tools, or platforms you’re already using. This simplifies the process of sharing inventory data with suppliers, warehouses, or other stakeholders in your supply chain.

Faster Inventory Updates: The FTP-based inventory update workflow allows for rapid and frequent updates, ensuring your Shopify store’s inventory data is always up-to-date. This translates to better stock control, minimized stockouts, and improved customer satisfaction.

Scalability: As your store grows, so does the volume of inventory data you need to manage. This workflow with FTP inventory feeds can easily scale with your business, ensuring that your inventory management system remains efficient and effective, no matter the size of your store.

Customization: With the help of MESA, you can tailor the FTP inventory feeds to suit the unique needs of your store. This allows you to create tailored automation workflows that address specific challenges and drive further operational efficiencies.

By leveraging the power of FTP-based inventory updates, you can stay competitive in the fast-paced world of ecommerce while maximizing the value of your resources.

Watch the tutorial video

Video tutorial how to use FTP and CSV files to update product inventory on Shopify

Start with our workflow template

The easiest way to add this workflow is by using our template. We’ll guide you through each step to personalize this automation.

Step-by-step workflow instructions

Time needed: 10 minutes

To get started, be sure to install MESA on your Shopify store. Then, follow these step-by-step instructions to connect FTP files to your Shopify store.

  1. First, create a workflow using the FTP by MESA trigger step

    Be sure to add your FTP server account credentials to authenticate this app.FTP - fetch CSV file

  2. Next, update the File Name and frequency options

    Add the file name and path if necessary. The frequency controls how often this trigger event will run this workflow.update CSV file path on ftp server

  3. Next, add Loop by MESA

    In the field for “Values to loop over”, be sure to add the variable {{ftp}}loop over values in CSV file from ftp server

  4. Next, add the Custom Code by MESA action step

    Then, add this description so you know what this step is all about: Retrieve product variant details that match with the SKU via Shopify GraphQL. Add the Inventory Item ID to the payload that gets pass to the next step.custom code step

  5. Click Edit Code to view the code editor

    Add the following code snippet to add the inventory item ID. The easiest way is to select the code below and replace the contents entirely:

    const Mesa = require('vendor/Mesa.js');
    const ShopifyGraphql = require('vendor/ShopifyGraphql.js');
    const Shopify = require('vendor/Shopify.js');

    /**
    * A Mesa Script exports a class with a script() method.
    */
    module.exports = new class {

    /**
    * Mesa Script
    *
    * @param {object} payload The payload data
    * @param {object} context Additional context about this task
    */
    script = (payload, context) => {
    // Assign variables
    const vars = context.steps;
    let inventoryItemIdGid = 0;
    const productSku = vars.loop.SKU;
    Mesa.log.info("Product SKU", productSku);

    // Set up Shopify GraphQL query and retrieve product variant details based on SKU
    let query = `
    query($query: String!) {
    productVariants(first: 3, query: $query) {
    edges {
    node {
    displayName
    id
    sku
    inventoryItem {
    id
    }
    product {
    id
    title
    }
    }
    }
    }
    }
    `;
    const response = ShopifyGraphql.send(query, {
    "query": "sku:" + productSku,
    });
    Mesa.log.info("Response", response);

    // Get Inventory Item ID from Shopify GraphQL response and include in vars.loop payload
    if (
    response &&
    response.data &&
    response.data.productVariants &&
    response.data.productVariants.edges[0] &&
    response.data.productVariants.edges[0].node &&
    response.data.productVariants.edges[0].node.inventoryItem &&
    response.data.productVariants.edges[0].node.inventoryItem.id
    ) {
    inventoryItemIdGid = response.data.productVariants.edges[0].node.inventoryItem.id;
    vars.loop.inventory_item_id = inventoryItemIdGid.match(/\d+/)[0];
    Mesa.log.info("Inventory Item ID", vars.loop.inventory_item_id);

    // We're done, call the next step!
    Mesa.output.next(vars.loop);
    } else {
    Mesa.log.info('No Inventory Item ID included. Do not continue to next step');
    }
    }
    }



    Save your workflow.custom liquid code to set inventory levels from a CSV

  6. Next, add Shopify to your workflow and choose the Set Inventory Level action

    To narrow your search more quickly use the filter search bar.shopify set inventory level

  7. Next, add the variables to the Set Inventory Level action

    Click the {+} icon button per field to choose their respective variable values.

    Note: If you haven’t saved your workflow yet, the variables may not appear. You can copy/paste the values below or Save and name your workflow then, the variable will be available to select from the side sheet.

    Available quantity: {{ loop.Inventory }}
    Location: Choose the right one for your store
    Inventory Item ID: Custom value, then enter {{ custom.inventory_item_id }}shopify set inventory levels

  8. Finally, Save then, name your new workflow.

    Be sure to turn you workflow On for it to run automatically.workflow complete: Update Shopify inventory levels from a CSV file on an FTP server

Workflow wrap-up

In conclusion, updating your Shopify product inventory using FTP files and FTP inventory feeds is a powerful and efficient method that offers numerous benefits for you and your team.

As you strive to stay ahead in the competitive ecommerce landscape, adopting innovative techniques like FTP-based inventory updates and incorporating FTP inventory feeds is essential. By leveraging the power of MESA to automate and customize this workflow, you can unlock new levels of efficiency and success in your store. Don’t miss the opportunity to streamline your inventory management and make the most of your resources.

Give this method a try and experience the transformative impact it can have on your Shopify store’s operations.

So, what's next?

  1. Add MESA from the Shopify App Store. Enjoy a 7-day free trial to start.
  2. Ask the experts if you need help personalizing any workflow, or ask us to build one for you. We're happy to help!
  3. Discover pre-made, customizeable automation templates.
We literally wrote the book on Shopify automation

Learn how to make Shopify work easier with your business processes.

Get the playbook - Free!

shopify automation playbook PDF