Skip to content

Commit

Permalink
update inventory export task (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
tekhaus committed Jul 4, 2024
1 parent 018b975 commit e6077c1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ This directory is built automatically. Each task's documentation is generated fr
* [Auto-sort collections by inventory levels](./auto-sort-collections-by-inventory-levels)
* [Auto-tag out-of-stock products](./auto-tag-out-of-stock-products)
* [Auto-tag products with incoming inventory](./auto-tag-products-with-incoming-inventory)
* [Backup inventory to SFTP in Shopify CSV format](./backup-scheduled-inventory-exports-in-shopifys-csv-format)
* [Create a product inventory CSV feed](./create-a-product-inventory-feed)
* [Email a summary of all products and quantities ordered](./email-a-summary-of-all-products-and-quantities-ordered)
* [Hide out-of-stock products](./hide-out-of-stock-products)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Backup inventory to SFTP in Shopify CSV format

Tags: Backups, CSV, Export, FTP
Tags: Backups, CSV, Export, FTP, Inventory

On a configurable schedule, this task generates a Shopify-friendly CSV of your inventory, and uploads it to the SFTP destination of your choice, and/or sends it via email. This is a convenient way to keep regular backups of your entire product inventory: simply import a CSV to restore your inventory to that point in time. ([Learn more about CSV imports and exports of Shopify inventory.](https://help.shopify.com/en/manual/locations/changing-quantities/exporting-or-importing-inventory))
On a configurable schedule, this task generates a Shopify-friendly CSV of your inventory, and uploads it to the SFTP destination of your choice, and/or sends it via email. This is a convenient way to keep regular backups of your entire product inventory: simply import a CSV to restore your inventory to that point in time. ([Learn more about CSV imports and exports of Shopify inventory.](https://help.shopify.com/en/manual/products/inventory/getting-started-with-inventory/inventory-csv))

* View in the task library: [tasks.mechanic.dev/backup-scheduled-inventory-exports-in-shopifys-csv-format](https://tasks.mechanic.dev/backup-scheduled-inventory-exports-in-shopifys-csv-format)
* Task JSON, for direct import: [task.json](../../tasks/backup-scheduled-inventory-exports-in-shopifys-csv-format.json)
Expand Down Expand Up @@ -40,7 +40,7 @@ mechanic/shopify/bulk_operation

## Documentation

On a configurable schedule, this task generates a Shopify-friendly CSV of your inventory, and uploads it to the SFTP destination of your choice, and/or sends it via email. This is a convenient way to keep regular backups of your entire product inventory: simply import a CSV to restore your inventory to that point in time. ([Learn more about CSV imports and exports of Shopify inventory.](https://help.shopify.com/en/manual/locations/changing-quantities/exporting-or-importing-inventory))
On a configurable schedule, this task generates a Shopify-friendly CSV of your inventory, and uploads it to the SFTP destination of your choice, and/or sends it via email. This is a convenient way to keep regular backups of your entire product inventory: simply import a CSV to restore your inventory to that point in time. ([Learn more about CSV imports and exports of Shopify inventory.](https://help.shopify.com/en/manual/products/inventory/getting-started-with-inventory/inventory-csv))

To only export certain products, set the "Only export products matching this query" option to a search query that works with Shopify's inventory admin area. For example, to only export products tagged "backmeup", use the search query "tag:backmeup".

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
location {
name
}
available
quantities(names: "available") {
quantity
}
}
}
}
Expand Down Expand Up @@ -123,8 +125,8 @@
{% if event.preview %}
{% capture jsonl_string %}
{"id":"gid:\/\/shopify\/ProductVariant\/1234567890","__typename":"ProductVariant","product":{"handle":"log","title":"Log","options":[{"name":"Size","position":1}]},"selectedOptions":[{"name":"Size","value":"Petite"}],"sku":"LOG-3","inventoryItem":{"tracked":true}}
{"id":"gid:\/\/shopify\/InventoryLevel\/1357924680?inventory_item_id=1470258369","__typename":"InventoryLevel","location":{"name":"123 Main Street"},"available":9,"__parentId":"gid:\/\/shopify\/ProductVariant\/1234567890"}
{"id":"gid:\/\/shopify\/InventoryLevel\/2468013579?inventory_item_id=1470258369","__typename":"InventoryLevel","location":{"name":"987 Alley Way"},"available":8,"__parentId":"gid:\/\/shopify\/ProductVariant\/1234567890"}
{"id":"gid:\/\/shopify\/InventoryLevel\/1357924680?inventory_item_id=1470258369","__typename":"InventoryLevel","location":{"name":"123 Main Street"},"quantities":[{"quantity":9}],"__parentId":"gid:\/\/shopify\/ProductVariant\/1234567890"}
{"id":"gid:\/\/shopify\/InventoryLevel\/2468013579?inventory_item_id=1470258369","__typename":"InventoryLevel","location":{"name":"987 Alley Way"},"quantities":[{"quantity":8}],"__parentId":"gid:\/\/shopify\/ProductVariant\/1234567890"}
{% endcapture %}

{% assign bulkOperation = hash %}
Expand Down Expand Up @@ -233,12 +235,12 @@
{% endfor %}

{% comment %}
-- add inventory levels by location
-- add "available" inventory levels by location
{% endcomment %}

{% for inventory_level in variant.inventory_levels %}
{% assign location_name = inventory_level.location.name %}
{% assign variant_row[location_name] = inventory_level.available %}
{% assign variant_row[location_name] = inventory_level.quantities.first.quantity %}
{% endfor %}

{% comment %}
Expand Down
Loading

0 comments on commit e6077c1

Please sign in to comment.