Articles in this section

Fulfillment flow changes in Shopify - lexbizz template

The lexbizz shipments to Shopify fulfillments flow is a partial fulfillment flow that does fulfillments in Shopify. To identify the flow in your integrator.io account, follow the steps in the Find deprecated endpoints in existing flows.

Before you update the lexbizz shipments to Shopify fulfillments flow, download the zip file to your local drive.

Download

Install and configure the custom flow by following the steps mentioned in the Install integration section and Configure integration section of the Install integration or download integration zip article.

You have two options to update the lexbizz shipments to Shopify fulfillments flow, but we recommend using the first one:

  • Option 1: In the newly installed flow, update all the mappings or other customizations or important configurations based on the old flow. 
  • Option 2: In the old flow, update the imports, exports, mappings, and any other flow configurations by referring to the newly installed flow. 

If you have chosen to use Option 1 to update the flow, once all the mapping updates are done in the new flow based on the old flow, refer to the Last run details (run timestamp) of the old flow and use the Custom run in Run now setting to run the new flow for the first time so that the flow doesn't sync all the records again.

mceclip0.png

Once the Custom run is complete, click the Run now setting and close the window, and then schedule the new flow by referring to the old flow schedule details.

If you are using Option 2 to update the lexbizz shipments to Shopify fulfillments flow, follow the below instructions:

  1. Log in to your integrator.io account.
  2. In the Shopify - lexbizz template, go to the lexbizz shipments to Shopify fulfillments flow.
  3. Open the fulfillment import mappings and take a copy of the existing mappings as the new changes would remove the old mappings. You can capture screenshots of the existing mappings or clone the flow so that the mappings and other components will be stored for future reference. For more information, see Clone integrations and flows.
  4. Follow the instructions from Steps 3 to 8, 13 to 14, and 16 to 18 in the section Create a new Fulfillment(Deprecated) to Creates a fulfillment for one or many fulfillment orders.
  5. After adding the lookup Get a list of fulfillment orders for a specific order, and import steps Move the location of fulfillment Order and Import Shopify fulfillments. Create a script under Resources > Scripts.
    mceclip0.png

    Note: Make sure you have checked Developer mode in your profile settings.

  6. In the Name field, provide a name to the script.
  7. In the Edit content, paste the below code. The below script assumes that the data structure in the flow is the same as when it was installed.
    function postResponseMap(options) {
      var newObj = JSON.parse(JSON.stringify(options.postResponseMapData[0]))
      var oldObj = options.postResponseMapData[0]
      for (var i = 0; i < newObj.fulfillmentOrders.length; i++) {
          delete newObj.fulfillmentOrders[i].line_items
          newObj.fulfillmentOrders[i].line_items = []
      }
      for (var j = 0; j < newObj.lexbizzOrders.Details.length; j++) {
          var etailOrderLineId = newObj.lexbizzOrders.Details[j].LineDescription["value"];
          for (var l = 0; l < newObj.fulfillmentOrders.length; l++) {
              var oldLineItems = []
              oldLineItems = options.postResponseMapData[0].fulfillmentOrders[l].line_items
              for (var k = 0; k < oldLineItems.length; k++) {
                  if (etailOrderLineId == oldLineItems[k].line_item_id) {
                      newObj.fulfillmentOrders[l].line_items.push(oldLineItems[k])
                      if (newObj.lexbizzOrders.Details[j].QtyOnShipments.value <= newObj.fulfillmentOrders[l].line_items[k].fulfillable_quantity) {
                          newObj.fulfillmentOrders[l].line_items[k].newQuantity = newObj.lexbizzOrders.Details[j].QtyOnShipments.value
                      } else {
                          newObj.fulfillmentOrders[l].line_items[k].newQuantity = newObj.fulfillmentOrders[l].line_items[k].fulfillable_quantity
                      }
                  }
              }
          }
      }
      for (var q = 0; q < newObj.fulfillmentOrders.length; q++) {
          var orgLineItems = newObj.fulfillmentOrders[q].line_items
          delete newObj.fulfillmentOrders[q].line_items
          newObj.fulfillmentOrders[q].line_items = orgLineItems.filter(array => array.newQuantity != 0)
      }
      var orgfulfillmentOrders = newObj.fulfillmentOrders
      delete newObj.fulfillmentOrders
      newObj.fulfillmentOrders = orgfulfillmentOrders.filter(orderArray => orderArray.line_items.length != 0)
      var data = []
      data.push(newObj)
      return data
    }
  8. Go back to the flow. In the Get a list of fulfillment orders for a specific order lookup, click + and then click the hook as shown in the screenshot.
  9. Select the script that you have created.
  10. Click Save and then click Close.
    mceclip1.png
  11. Open the Get a list of fulfillment orders for a specific order lookup step, in the Order ID field, enter the value {{{lexbizzOrders.ExternalRef.value}}} as shown in the screenshot.
    mceclip2.png
  12. Open the Move the location of fulfillment Order import step, in the Path to many field,  enter the value fulfillmentOrders
    mceclip3.png
  13. In the Which field? setting, enter id as shown below in the screenshot.
  14. In the Move the location of fulfillment Order import, add an input filter as shown in the below screenshot.
    mceclip0.png
  15. Open the mappings of the Import Shopify fulfillments and use mapper 2.0 to configure the mappings provided in the table below.

    Destination record fields

    Source record fields

    fulfillment.tracking_info.number

    $.shipment.Packages[0].TrackingNbr.value

    fulfillment.line_items_by_fulfillment_order[*].fulfillment_order_id

    $.fulfillmentOrders[*].id

    fulfillment.line_items_by_fulfillment_order[*].fulfillment_order_line_items[*].id

    $.fulfillmentOrders[*].line_items[*].id

    fulfillment.line_items_by_fulfillment_order[*].fulfillment_order_line_items[*].quantity

    $.fulfillmentOrders[*].line_items[*].newQuantity
    mceclip4.png
  16. In the Import Shopify fulfillments import, add an input filter to allow only the records with fulfillmentOrders length greater than zero.
    mceclip0.png

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.