-
-
Save basilkhan05/ecd2bdaa9cccd682af2a369e6a92fe27 to your computer and use it in GitHub Desktop.
Merging line items with the same SKU for bundles in Shopify order packing slips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign unique_line_item_skus = line_items_in_shipment | map: 'sku' | uniq %} | |
{% for line_item_sku in unique_line_item_skus %} | |
{% assign total_quantity = 0 %} | |
{% assign total_shipping_quantity = 0 %} | |
{% assign sku_line_items = line_items_in_shipment | where: "sku", line_item_sku %} | |
{% for line_item in sku_line_items %} | |
{% assign total_quantity = total_quantity | plus: line_item.quantity %} | |
{% assign total_shipping_quantity = total_shipping_quantity | plus: line_item.shipping_quantity %} | |
{% endfor %} | |
{% assign line_item = sku_line_items | first %} | |
<!-- Keep the existing template intact in the for loop intact --> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment