Glitches in Flow email including line items and quantity from only one fulfillment order

Glitches in Flow email including line items and quantity from only one fulfillment order

amanda-91
Shopify Partner
85 0 53

I have two locations which can ship the same items. I use location-2 as an overflow if location-1 can’t ship the total quantity of a product, in those cases I might ship what I can from location-1 and mark fulfilled to trigger sending of this email to location-2 to ship the remaining quantity.


The Flow is setup like this:

  1. Start when… Order fulfilled
  2. Check if… fulfillment.requiresShipping AND fulfillment.location.name does NOT include location-1
  3. Then… send the following internal email (which is intended to include only items fulfilled while assigned to location-2)

Problem 1: I recently noticed that the table included the total quantity of a line item ordered instead of only the quantity assigned to location-2. I.e. the order has qty-5 of shirt; location-1 ships 3; the remaining two are moved to location-2; this email should then request location-2 only send the two. However the email requested all 5 instead of only the two which were assigned to location-2. I’m not sure how to further contain the line quantity to only those in the specific fulfillment at hand versus the total number ordered on the parent order item?

 

Problem 2: I recently had a customer change items on his order. I edited the order, removing some items and adding others. However the table included ALL of the items, both currently active and removed by the edit. Is there some if-condition check I can add to fulfillmentOrders_item.lineItems to exclude items that are removed and not included in the fulfillment request?

 

<table>
  <tbody>

    {%- for fulfillmentOrders_item in fulfillment.fulfillmentOrders -%}

    {% comment %} Sort rows by title {% endcomment %}

      {% assign lines_by_title = fulfillmentOrders_item.lineItems | sort: 'productTitle' %}

      {% for line in lines_by_title %}

          {%- assign line_quantity = line.lineItem.quantity | times: 1 -%}

          {% comment %} Running count of fulfillment total items {% endcomment %}
          {%- assign total_item_count = total_item_count | plus: line_quantity -%}

          <tr>

            <td>{{ line_quantity }}</td>

            {% comment %} Supplier-sku metafield instead of SKU {% endcomment %}

            <td>
              {% assign supplier_sku = line.lineItem.variant.metafields
                | where: 'namespace', 'inventory'
                | where: 'key', 'sku_supplier'
                | first
              -%}
              {{- supplier_sku.value }}
            </td>

            {%- capture variant_line -%}
            {{ line.productTitle }}{%- if line.variantTitle -%}, {{ line.variantTitle }}{%- endif -%}
            {%- endcapture -%}
            <td>
              {{ variant_line }}
            </td>

          </tr>

      {%- endfor -%}
    {%- endfor -%}
  </tbody>
</table>

 

Reply 1 (1)

paul_n
Shopify Staff
1774 194 415

In both of these, it's not clear what you want to do, as the language isn't precise enough. Can you refine?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.