Due to the ever-changing nature of writing and maintaining scripts, Infoplus does not provide support in this area. We recommend someone in your IT Department handles scripting requests internally so that you keep all control over the process.

By default, Infoplus will manually import an order from Shopify regardless of its fulfillment status.  This includes automated order imports that result from a web-hook notification, as well as any orders specified for manual import using the "Import Orders" process from a Shopping Cart Connection record within Infoplus.  You may prefer to have Infoplus reject orders based on their 'fulfillment status', such as excluding orders that have already been fulfilled, when importing old orders when bringing on a new client.  This can be accomplished using an Infoplus Script.

The first step is creating a script with the Script Type of "Shopping Cart Connection Order".  Next, populate the code section of the script with the following.

var STATUS_FIELD_NAME = "fulfillment_status";
var REJECT_STATUS_VALUE = "fulfilled"

utils.log("Running Shopify Shopping Cart Connection Reject Fulfilled Orders Script"); 
var order = orderData.get("order");
utils.log("Evaluating Order With Id: " + order.get("id"));

    var orderFulfillmentStatus = order.get(STATUS_FIELD_NAME);
    utils.log("Found fulfillment status of: " + orderFulfillmentStatus);
    if(orderFulfillmentStatus == REJECT_STATUS_VALUE)
        var rejectReason = "Rejecting Order because its " + STATUS_FIELD_NAME + " is '" + REJECT_STATUS_VALUE + "'.";
    utils.log("Allowing order to import because it's status is '" + orderFulfillmentStatus + "' and NOT '" + REJECT_STATUS_VALUE + "'.");
    utils.log("Found order without a value for '" + STATUS_FIELD_NAME + "', allowing order to be imported.");

After the script is written and saved, it must be applied to the the Shopify Shopping Cart Connection record in Infoplus.  Navigate to this record, select edit from the actions menu (or press the 'e' key), then in the script field select the script that was previously created.  Finally, don't forget to save the connection by clicking the Save button at the bottom of the changes. 

Once the script has been applied to the shopping cart connection, the script log table can be used to confirm the script is working as expected.  

Related Information: