Every morning, one email with yesterday's Shopify orders, sales and best sellers, and every tracked item running low or sold out.

UsesGmailShopify

Start every day with your Shopify sales and stock

ScheduleRun every day at 07:00.Run every day at 07:00.
ValuesSet recipientEmail to blank.Set recipientEmail to blank.
ValuesSet lowStockThreshold to 5.Set lowStockThreshold to 5.
ValuesSet maxOrdersForTopProducts to 100.Set maxOrdersForTopProducts to 100.
TextTrim recipientEmail and save it as sendTo.Trim recipientEmail and save it as sendTo.
Decisions & LoopsIf sendTo doesn't contain @If sendTo doesn't contain @
Yes
Decisions & LoopsStop and report a problem: '@sendTo' in the 'recipientEmail' step does not look like an email address. Put the address the brief should go to there, such as you@yourstore.com, then run it again.Stop and report a problem: '@sendTo' in the 'recipientEmail' step does not look like an email address. Put the address the brief should go to there, such as you@yourstore.com, then run it again.
No
No steps
MathRound maxOrdersForTopProducts down and save it as orderCap.Round maxOrdersForTopProducts down and save it as orderCap.
ValuesSet store to an empty record.Set store to an empty record.
Decisions & LoopsIf a step below fails, save the error as shopErrorIf a step below fails, save the error as shopError
Try
ShopifyShopifyGet your store. Save it as store.Get your store. Save it as store.
On error
Decisions & LoopsStop and report a problem: Lodol could not read your Shopify store, so no brief was sent. Check the Shopify connection under Integrations, then run this again. Shopify said: shopError.message.Stop and report a problem: Lodol could not read your Shopify store, so no brief was sent. Check the Shopify connection under Integrations, then run this again. Shopify said: shopError.message.
ValuesSet storeName to store.shop.name.Set storeName to store.shop.name.
ValuesSet storeZone to store.shop.ianaTimezone.Set storeZone to store.shop.ianaTimezone.
ValuesSet storeCurrency to store.shop.currencyCode.Set storeCurrency to store.shop.currencyCode.
Dates & TimesGet yesterday's date and save it as reportDay.Get yesterday's date and save it as reportDay.
Dates & TimesGet today's date and save it as today.Get today's date and save it as today.
Dates & TimesGet the day of the week for reportDay and save it as dayName.Get the day of the week for reportDay and save it as dayName.
Dates & TimesMake reportDay readable as “Monday, November 2” and save it as dayLabel.Make reportDay readable as “Monday, November 2” and save it as dayLabel.
Dates & TimesMake reportDay readable as “2026-11-02T14:05:00Z” and save it as dayStart.Make reportDay readable as “2026-11-02T14:05:00Z” and save it as dayStart.
Dates & TimesMake today readable as “2026-11-02T14:05:00Z” and save it as dayEnd.Make today readable as “2026-11-02T14:05:00Z” and save it as dayEnd.
Dates & TimesMake dayStart readable as “2026-11-02” and save it as searchFrom.Make dayStart readable as “2026-11-02” and save it as searchFrom.
Dates & TimesMake dayEnd readable as “2026-11-02” and save it as searchTo.Make dayEnd readable as “2026-11-02” and save it as searchTo.
Dates & TimesGet the date 7 days before reportDay and save it as weekBeforeDay.Get the date 7 days before reportDay and save it as weekBeforeDay.
Dates & TimesGet the date 6 days before reportDay and save it as weekBeforeNextDay.Get the date 6 days before reportDay and save it as weekBeforeNextDay.
Dates & TimesMake weekBeforeDay readable as “2026-11-02T14:05:00Z” and save it as weekBeforeStart.Make weekBeforeDay readable as “2026-11-02T14:05:00Z” and save it as weekBeforeStart.
Dates & TimesMake weekBeforeNextDay readable as “2026-11-02T14:05:00Z” and save it as weekBeforeEnd.Make weekBeforeNextDay readable as “2026-11-02T14:05:00Z” and save it as weekBeforeEnd.
Dates & TimesMake weekBeforeStart readable as “2026-11-02” and save it as weekBeforeFrom.Make weekBeforeStart readable as “2026-11-02” and save it as weekBeforeFrom.
Dates & TimesMake weekBeforeEnd readable as “2026-11-02” and save it as weekBeforeTo.Make weekBeforeEnd readable as “2026-11-02” and save it as weekBeforeTo.
ValuesSet dayOrders to an empty list.Set dayOrders to an empty list.
ValuesSet orderCursor to blank.Set orderCursor to blank.
ValuesSet moreOrderPages to true.Set moreOrderPages to true.
Decisions & LoopsWhile moreOrderPages is yes:While moreOrderPages is yes:
ValuesSet orderPage to an empty record.Set orderPage to an empty record.
Decisions & LoopsIf a step below fails, save the error as ordersErrorIf a step below fails, save the error as ordersError
Try
ShopifyShopifyList orders. Save it as orderPage.List orders. Save it as orderPage.
On error
Decisions & LoopsStop and report a problem: Lodol could not read yesterday's orders from Shopify, so no brief was sent. Shopify said: ordersError.message.Stop and report a problem: Lodol could not read yesterday's orders from Shopify, so no brief was sent. Shopify said: ordersError.message.
ListsKeep each item in orderPage.orders where item.createdAt is greater than or equal to dayStart and item.createdAt is… and save it as pageOrders.Keep each item in orderPage.orders where item.createdAt is greater than or equal to dayStart and item.createdAt is… and save it as pageOrders.
ListsCombine dayOrders and pageOrders into one list and save it as dayOrders.Combine dayOrders and pageOrders into one list and save it as dayOrders.
ValuesChange orderCursor to orderPage.next_cursor.Change orderCursor to orderPage.next_cursor.
ValuesChange moreOrderPages to orderPage.has_more.Change moreOrderPages to orderPage.has_more.
Decisions & LoopsIf orderPage.orders[-1].createdAt is greater than or equal to dayEndIf orderPage.orders[-1].createdAt is greater than or equal to dayEnd
Yes
ValuesChange moreOrderPages to false.Change moreOrderPages to false.
No
No steps
ListsCount the items in dayOrders and save it as orderCount.Count the items in dayOrders and save it as orderCount.
ListsGet totalPriceSet.shopMoney.amount from every item in dayOrders and save it as orderTotals.Get totalPriceSet.shopMoney.amount from every item in dayOrders and save it as orderTotals.
MathAdd up orderTotals and save it as grossSales.Add up orderTotals and save it as grossSales.
ListsGet totalRefundedSet.shopMoney.amount from every item in dayOrders and save it as orderRefunds.Get totalRefundedSet.shopMoney.amount from every item in dayOrders and save it as orderRefunds.
MathAdd up orderRefunds and save it as refundedSales.Add up orderRefunds and save it as refundedSales.
MathSet netSales to grossSales minus refundedSales.Set netSales to grossSales minus refundedSales.
ValuesSet weekBeforeOrders to an empty list.Set weekBeforeOrders to an empty list.
ValuesSet weekBeforeCursor to blank.Set weekBeforeCursor to blank.
ValuesSet moreWeekBeforePages to true.Set moreWeekBeforePages to true.
Decisions & LoopsWhile moreWeekBeforePages is yes:While moreWeekBeforePages is yes:
ValuesSet weekBeforePage to an empty record.Set weekBeforePage to an empty record.
Decisions & LoopsIf a step below fails, save the error as weekBeforeErrorIf a step below fails, save the error as weekBeforeError
Try
ShopifyShopifyList orders. Save it as weekBeforePage.List orders. Save it as weekBeforePage.
On error
Decisions & LoopsStop and report a problem: Lodol could not read last week's orders from Shopify for the comparison, so no brief was sent. Shopify said: weekBeforeError.message.Stop and report a problem: Lodol could not read last week's orders from Shopify for the comparison, so no brief was sent. Shopify said: weekBeforeError.message.
ListsKeep each item in weekBeforePage.orders where item.createdAt is greater than or equal to weekBeforeStart and item.createdAt… and save it as weekBeforeMatches.Keep each item in weekBeforePage.orders where item.createdAt is greater than or equal to weekBeforeStart and item.createdAt… and save it as weekBeforeMatches.
ListsCombine weekBeforeOrders and weekBeforeMatches into one list and save it as weekBeforeOrders.Combine weekBeforeOrders and weekBeforeMatches into one list and save it as weekBeforeOrders.
ValuesChange weekBeforeCursor to weekBeforePage.next_cursor.Change weekBeforeCursor to weekBeforePage.next_cursor.
ValuesChange moreWeekBeforePages to weekBeforePage.has_more.Change moreWeekBeforePages to weekBeforePage.has_more.
Decisions & LoopsIf weekBeforePage.orders[-1].createdAt is greater than or equal to weekBeforeEndIf weekBeforePage.orders[-1].createdAt is greater than or equal to weekBeforeEnd
Yes
ValuesChange moreWeekBeforePages to false.Change moreWeekBeforePages to false.
No
No steps
ListsCount the items in weekBeforeOrders and save it as weekBeforeCount.Count the items in weekBeforeOrders and save it as weekBeforeCount.
ListsGet totalPriceSet.shopMoney.amount from every item in weekBeforeOrders and save it as weekBeforeTotals.Get totalPriceSet.shopMoney.amount from every item in weekBeforeOrders and save it as weekBeforeTotals.
MathAdd up weekBeforeTotals and save it as weekBeforeGross.Add up weekBeforeTotals and save it as weekBeforeGross.
ListsGet totalRefundedSet.shopMoney.amount from every item in weekBeforeOrders and save it as weekBeforeRefunds.Get totalRefundedSet.shopMoney.amount from every item in weekBeforeOrders and save it as weekBeforeRefunds.
MathAdd up weekBeforeRefunds and save it as weekBeforeRefunded.Add up weekBeforeRefunds and save it as weekBeforeRefunded.
MathSet weekBeforeSales to weekBeforeGross minus weekBeforeRefunded.Set weekBeforeSales to weekBeforeGross minus weekBeforeRefunded.
MathRound netSales to 2 decimal places and save it as salesRounded.Round netSales to 2 decimal places and save it as salesRounded.
MathFormat salesRounded as a currency and save it as salesText.Format salesRounded as a currency and save it as salesText.
MathRound weekBeforeSales to 2 decimal places and save it as weekBeforeRounded.Round weekBeforeSales to 2 decimal places and save it as weekBeforeRounded.
MathFormat weekBeforeRounded as a currency and save it as weekBeforeSalesText.Format weekBeforeRounded as a currency and save it as weekBeforeSalesText.
ValuesSet averageOrder to 0.Set averageOrder to 0.
Decisions & LoopsIf orderCount is greater than 0If orderCount is greater than 0
Yes
MathChange averageOrder to netSales divided by orderCount.Change averageOrder to netSales divided by orderCount.
No
No steps
MathRound averageOrder to 2 decimal places and save it as averageRounded.Round averageOrder to 2 decimal places and save it as averageRounded.
MathFormat averageRounded as a currency and save it as averageText.Format averageRounded as a currency and save it as averageText.
ValuesSet orderWord to orders.Set orderWord to orders.
Decisions & LoopsIf orderCount is 1If orderCount is 1
Yes
ValuesChange orderWord to order.Change orderWord to order.
No
No steps
ValuesSet weekBeforeOrderWord to orders.Set weekBeforeOrderWord to orders.
Decisions & LoopsIf weekBeforeCount is 1If weekBeforeCount is 1
Yes
ValuesChange weekBeforeOrderWord to order.Change weekBeforeOrderWord to order.
No
No steps
TextBuild the text the same as the @dayName before and save it as ordersComparison.Build the text the same as the @dayName before and save it as ordersComparison.
Decisions & LoopsIf orderCount is greater than weekBeforeCountIf orderCount is greater than weekBeforeCount
Yes
TextBuild the text up from @weekBeforeCount the @dayName before and save it as ordersComparison.Build the text up from @weekBeforeCount the @dayName before and save it as ordersComparison.
Else if @orderCount is less than @weekBeforeCount
TextBuild the text down from @weekBeforeCount the @dayName before and save it as ordersComparison.Build the text down from @weekBeforeCount the @dayName before and save it as ordersComparison.
Otherwise
No steps
TextBuild the text the same as the @dayName before and save it as salesComparison.Build the text the same as the @dayName before and save it as salesComparison.
Decisions & LoopsIf weekBeforeRounded is less than or equal to 0If weekBeforeRounded is less than or equal to 0
Yes
TextBuild the text with no sales the @dayName before and save it as salesComparison.Build the text with no sales the @dayName before and save it as salesComparison.
Else if @salesRounded is not @weekBeforeRounded
MathSet salesChange to salesRounded minus weekBeforeRounded.Set salesChange to salesRounded minus weekBeforeRounded.
MathCalculate the absolute value of salesChange and save it as salesSwing.Calculate the absolute value of salesChange and save it as salesSwing.
MathSet swingShare to salesSwing divided by weekBeforeRounded.Set swingShare to salesSwing divided by weekBeforeRounded.
MathFormat swingShare as a percentage with 0 decimal places and save it as swingPercent.Format swingShare as a percentage with 0 decimal places and save it as swingPercent.
ValuesSet salesDirection to up.Set salesDirection to up.
Decisions & LoopsIf salesChange is less than 0If salesChange is less than 0
Yes
ValuesChange salesDirection to down.Change salesDirection to down.
No
No steps
TextBuild the text @salesDirection @swingPercent from @weekBeforeSalesText the @dayName before and save it as salesComparison.Build the text @salesDirection @swingPercent from @weekBeforeSalesText the @dayName before and save it as salesComparison.
Otherwise
No steps
TextBuild the text Orders: @orderCount, @ordersComparison Sales: @salesText, @salesComparison Average order: @averageText and save it as salesSection.Build the text Orders: @orderCount, @ordersComparison Sales: @salesText, @salesComparison Average order: @averageText and save it as salesSection.
Decisions & LoopsIf orderCount is 0 and weekBeforeCount is 0If orderCount is 0 and weekBeforeCount is 0
Yes
TextBuild the text No orders yesterday, and none the @dayName before either. and save it as salesSection.Build the text No orders yesterday, and none the @dayName before either. and save it as salesSection.
Else if @orderCount is 0
TextBuild the text No orders yesterday. The @dayName before had @weekBeforeCount @weekBeforeOrderWord and @weekBeforeSalesText in sales. and save it as salesSection.Build the text No orders yesterday. The @dayName before had @weekBeforeCount @weekBeforeOrderWord and @weekBeforeSalesText in sales. and save it as salesSection.
Otherwise
No steps
ListsTake the first orderCap items of dayOrders and save it as ordersToRank.Take the first orderCap items of dayOrders and save it as ordersToRank.
ValuesSet soldItems to an empty list.Set soldItems to an empty list.
ValuesSet unreadOrders to an empty list.Set unreadOrders to an empty list.
ValuesSet lastOrderError to blank.Set lastOrderError to blank.
Decisions & LoopsFor each order in ordersToRank:For each order in ordersToRank:
Decisions & LoopsIf a step below fails, save the error as orderErrorIf a step below fails, save the error as orderError
Try
ShopifyShopifyGet order. Save it as orderDetail.Get order. Save it as orderDetail.
ListsCombine soldItems and orderDetail.order.lineItems.nodes into one list and save it as soldItems.Combine soldItems and orderDetail.order.lineItems.nodes into one list and save it as soldItems.
On error
ListsAdd order.name to the end of unreadOrders and save it as unreadOrders.Add order.name to the end of unreadOrders and save it as unreadOrders.
ValuesChange lastOrderError to orderError.message.Change lastOrderError to orderError.message.
ListsGroup the items in soldItems by title, with the total quantity of each and save it as productUnits.Group the items in soldItems by title, with the total quantity of each and save it as productUnits.
ListsSort productUnits by total, largest first and save it as rankedProducts.Sort productUnits by total, largest first and save it as rankedProducts.
ListsTake the first 5 items of rankedProducts and save it as topProducts.Take the first 5 items of rankedProducts and save it as topProducts.
ValuesSet topProductLines to an empty list.Set topProductLines to an empty list.
ValuesSet rank to 0.Set rank to 0.
Decisions & LoopsFor each product in topProducts:For each product in topProducts:
ValuesAdd 1 to rank.Add 1 to rank.
ValuesSet unitWord to units.Set unitWord to units.
Decisions & LoopsIf product.total is 1If product.total is 1
Yes
ValuesChange unitWord to unit.Change unitWord to unit.
No
No steps
ListsAdd rank. product.key: product.total unitWord to the end of topProductLines and save it as topProductLines.Add rank. product.key: product.total unitWord to the end of topProductLines and save it as topProductLines.
TextJoin topProductLines with a new line and save it as productsSection.Join topProductLines with a new line and save it as productsSection.
Decisions & LoopsIf orderCount is 0If orderCount is 0
Yes
ValuesChange productsSection to No orders, so nothing to rank..Change productsSection to No orders, so nothing to rank..
Else if @topProducts is empty
ValuesChange productsSection to None of yesterday's orders could be read, so there is no ranking today..Change productsSection to None of yesterday's orders could be read, so there is no ranking today..
Otherwise
No steps
ValuesSet rankingNote to blank.Set rankingNote to blank.
Decisions & LoopsIf orderCount is greater than orderCapIf orderCount is greater than orderCap
Yes
TextBuild the text (Counted from the first @orderCap of yesterday's @orderCount orders. Raise 'maxOrdersForTopProducts' to count more.) and save it as rankingNote.Build the text (Counted from the first @orderCap of yesterday's @orderCount orders. Raise 'maxOrdersForTopProducts' to count more.) and save it as rankingNote.
No
No steps
ListsCount the items in unreadOrders and save it as unreadCount.Count the items in unreadOrders and save it as unreadCount.
ListsTake the first 10 items of unreadOrders and save it as unreadShown.Take the first 10 items of unreadOrders and save it as unreadShown.
TextJoin unreadShown with , and save it as unreadList.Join unreadShown with , and save it as unreadList.
ValuesSet unreadVerb to are.Set unreadVerb to are.
Decisions & LoopsIf unreadCount is 1If unreadCount is 1
Yes
ValuesChange unreadVerb to is.Change unreadVerb to is.
No
No steps
ValuesSet unreadMore to blank.Set unreadMore to blank.
Decisions & LoopsIf unreadCount is greater than 10If unreadCount is greater than 10
Yes
TextJoin [ and , unreadCount minus 10, more] with nothing and save it as unreadMore.Join [ and , unreadCount minus 10, more] with nothing and save it as unreadMore.
No
No steps
ValuesSet unreadNote to blank.Set unreadNote to blank.
Decisions & LoopsIf unreadCount is greater than 0If unreadCount is greater than 0
Yes
TextBuild the text (@unreadCount of yesterday's orders could not be read from Shopify and @unreadVerb left out of this ranking: @unreadList@unreadMore.) and save it as unreadNote.Build the text (@unreadCount of yesterday's orders could not be read from Shopify and @unreadVerb left out of this ranking: @unreadList@unreadMore.) and save it as unreadNote.
No
No steps
ValuesSet lowStockItems to an empty list.Set lowStockItems to an empty list.
ValuesSet noStockFigure to an empty list.Set noStockFigure to an empty list.
ValuesSet stockFigures to an empty list.Set stockFigures to an empty list.
ValuesSet variantsChecked to 0.Set variantsChecked to 0.
ValuesSet trackedCount to 0.Set trackedCount to 0.
ValuesSet variantCursor to blank.Set variantCursor to blank.
ValuesSet moreVariantPages to true.Set moreVariantPages to true.
Decisions & LoopsWhile moreVariantPages is yes:While moreVariantPages is yes:
ValuesSet variantPage to an empty record.Set variantPage to an empty record.
Decisions & LoopsIf a step below fails, save the error as stockErrorIf a step below fails, save the error as stockError
Try
ShopifyShopifyList product variants. Save it as variantPage.List product variants. Save it as variantPage.
On error
Decisions & LoopsStop and report a problem: Lodol could not read your stock levels from Shopify, so no brief was sent. Shopify said: stockError.message.Stop and report a problem: Lodol could not read your stock levels from Shopify, so no brief was sent. Shopify said: stockError.message.
ListsKeep each item in variantPage.variants where item.inventoryItem.tracked is yes and save it as pageTracked.Keep each item in variantPage.variants where item.inventoryItem.tracked is yes and save it as pageTracked.
ListsKeep each item in pageTracked where item.product.status is not DRAFT and item.product.status is not ARCHIVED… and save it as pageLowStock.Keep each item in pageTracked where item.product.status is not DRAFT and item.product.status is not ARCHIVED… and save it as pageLowStock.
ListsKeep each item in variantPage.variants where item.inventoryItem is empty or item.inventoryItem.tracked is yes and… and save it as pageNoStockFigure.Keep each item in variantPage.variants where item.inventoryItem is empty or item.inventoryItem.tracked is yes and… and save it as pageNoStockFigure.
ListsCombine lowStockItems and pageLowStock into one list and save it as lowStockItems.Combine lowStockItems and pageLowStock into one list and save it as lowStockItems.
ListsCombine noStockFigure and pageNoStockFigure into one list and save it as noStockFigure.Combine noStockFigure and pageNoStockFigure into one list and save it as noStockFigure.
ListsKeep each item in pageTracked where item.inventoryQuantity isn't empty and save it as pageStockFigures.Keep each item in pageTracked where item.inventoryQuantity isn't empty and save it as pageStockFigures.
ListsCombine stockFigures and pageStockFigures into one list and save it as stockFigures.Combine stockFigures and pageStockFigures into one list and save it as stockFigures.
MathChange variantsChecked to variantsChecked plus variantPage.count.Change variantsChecked to variantsChecked plus variantPage.count.
ListsCount the items in pageTracked and save it as pageTrackedCount.Count the items in pageTracked and save it as pageTrackedCount.
MathChange trackedCount to trackedCount plus pageTrackedCount.Change trackedCount to trackedCount plus pageTrackedCount.
ValuesChange variantCursor to variantPage.next_cursor.Change variantCursor to variantPage.next_cursor.
ValuesChange moreVariantPages to variantPage.has_more.Change moreVariantPages to variantPage.has_more.
ListsCount the items in noStockFigure and save it as noStockFigureCount.Count the items in noStockFigure and save it as noStockFigureCount.
Decisions & LoopsIf noStockFigureCount is greater than 0 and stockFigures is emptyIf noStockFigureCount is greater than 0 and stockFigures is empty
Yes
Decisions & LoopsStop and report a problem: Shopify did not report a stock figure for any of your items, so no brief was sent. This usually means the Lodol app in your Shopify admin is missing the read_inventory access scope: add it in the app's Configuration in the Shopify Dev Dashboard, release a new version, install the app on the store again, then run this again.Stop and report a problem: Shopify did not report a stock figure for any of your items, so no brief was sent. This usually means the Lodol app in your Shopify admin is missing the read_inventory access scope: add it in the app's Configuration in the Shopify Dev Dashboard, release a new version, install the app on the store again, then run this again.
No
No steps
ListsSort lowStockItems by inventoryQuantity, smallest first and save it as sortedLowStock.Sort lowStockItems by inventoryQuantity, smallest first and save it as sortedLowStock.
ListsKeep each item in lowStockItems where item.inventoryQuantity is less than or equal to 0 and save it as outOfStock.Keep each item in lowStockItems where item.inventoryQuantity is less than or equal to 0 and save it as outOfStock.
ListsCount the items in outOfStock and save it as outCount.Count the items in outOfStock and save it as outCount.
ListsCount the items in lowStockItems and save it as lowStockCount.Count the items in lowStockItems and save it as lowStockCount.
MathSet runningLowCount to lowStockCount minus outCount.Set runningLowCount to lowStockCount minus outCount.
ListsTake the first 40 items of sortedLowStock and save it as stockShown.Take the first 40 items of sortedLowStock and save it as stockShown.
ValuesSet stockLines to an empty list.Set stockLines to an empty list.
Decisions & LoopsFor each variant in stockShown:For each variant in stockShown:
ValuesSet itemName to variant.product.title.Set itemName to variant.product.title.
Decisions & LoopsIf variant.title is not Default TitleIf variant.title is not Default Title
Yes
TextBuild the text @variant.product.title - @variant.title and save it as itemName.Build the text @variant.product.title - @variant.title and save it as itemName.
No
No steps
ValuesSet skuNote to blank.Set skuNote to blank.
Decisions & LoopsIf variant.sku isn't emptyIf variant.sku isn't empty
Yes
TextBuild the text (SKU @variant.sku) and save it as skuNote.Build the text (SKU @variant.sku) and save it as skuNote.
No
No steps
TextBuild the text @variant.inventoryQuantity left and save it as stockNow.Build the text @variant.inventoryQuantity left and save it as stockNow.
Decisions & LoopsIf variant.inventoryQuantity is less than 0If variant.inventoryQuantity is less than 0
Yes
MathCalculate the absolute value of variant.inventoryQuantity and save it as oversoldBy.Calculate the absolute value of variant.inventoryQuantity and save it as oversoldBy.
TextBuild the text out of stock, oversold by @oversoldBy and save it as stockNow.Build the text out of stock, oversold by @oversoldBy and save it as stockNow.
Else if @variant.inventoryQuantity is 0
ValuesChange stockNow to out of stock.Change stockNow to out of stock.
Otherwise
No steps
ListsAdd • itemName@skuNote: stockNow to the end of stockLines and save it as stockLines.Add • itemName@skuNote: stockNow to the end of stockLines and save it as stockLines.
TextJoin stockLines with a new line and save it as stockList.Join stockLines with a new line and save it as stockList.
MathSet stockNotShown to lowStockCount minus 40.Set stockNotShown to lowStockCount minus 40.
ValuesSet moreStockNote to blank.Set moreStockNote to blank.
Decisions & LoopsIf stockNotShown is greater than 0If stockNotShown is greater than 0
Yes
TextBuild the text ...and @stockNotShown more. Products > Inventory in Shopify lists them all. and save it as moreStockNote.Build the text ...and @stockNotShown more. Products > Inventory in Shopify lists them all. and save it as moreStockNote.
No
No steps
ValuesSet noStockFigureNote to blank.Set noStockFigureNote to blank.
Decisions & LoopsIf noStockFigureCount is greater than 0If noStockFigureCount is greater than 0
Yes
TextBuild the text (Shopify gave no stock figure for @noStockFigureCount of your items, so they were not checked.) and save it as noStockFigureNote.Build the text (Shopify gave no stock figure for @noStockFigureCount of your items, so they were not checked.) and save it as noStockFigureNote.
No
No steps
ValuesSet itemWord to items.Set itemWord to items.
Decisions & LoopsIf lowStockCount is 1If lowStockCount is 1
Yes
ValuesChange itemWord to item.Change itemWord to item.
No
No steps
TextBuild the text @lowStockCount @itemWord, @outCount of them out of stock and save it as stockSummary.Build the text @lowStockCount @itemWord, @outCount of them out of stock and save it as stockSummary.
Decisions & LoopsIf outCount is 0If outCount is 0
Yes
TextBuild the text @lowStockCount @itemWord running low and save it as stockSummary.Build the text @lowStockCount @itemWord running low and save it as stockSummary.
Else if @outCount is @lowStockCount
TextBuild the text @lowStockCount @itemWord, all out of stock and save it as stockSummary.Build the text @lowStockCount @itemWord, all out of stock and save it as stockSummary.
Decisions & LoopsIf lowStockCount is 1If lowStockCount is 1
Yes
ValuesChange stockSummary to 1 item, out of stock.Change stockSummary to 1 item, out of stock.
No
No steps
Otherwise
No steps
TextBuild the text @stockSummary: @stockList@moreStockNote@noStockFigureNote and save it as stockSection.Build the text @stockSummary: @stockList@moreStockNote@noStockFigureNote and save it as stockSection.
Decisions & LoopsIf variantsChecked is 0If variantsChecked is 0
Yes
ValuesChange stockSection to Your store has no products yet, so there is no stock to check..Change stockSection to Your store has no products yet, so there is no stock to check..
Else if @trackedCount is 0
TextBuild the text None of your products has 'Track quantity' turned on in Shopify, so there is no stock to check. Turn it on for a product to include it here.@noStockFigureNote and save it as stockSection.Build the text None of your products has 'Track quantity' turned on in Shopify, so there is no stock to check. Turn it on for a product to include it here.@noStockFigureNote and save it as stockSection.
Else if @lowStockCount is 0
TextBuild the text Every tracked item has more than @lowStockThreshold units in stock.@noStockFigureNote and save it as stockSection.Build the text Every tracked item has more than @lowStockThreshold units in stock.@noStockFigureNote and save it as stockSection.
Otherwise
No steps
TextBuild the text @orderCount @orderWord, @salesText in sales and save it as salesHeadline.Build the text @orderCount @orderWord, @salesText in sales and save it as salesHeadline.
Decisions & LoopsIf orderCount is 0If orderCount is 0
Yes
ValuesChange salesHeadline to no orders.Change salesHeadline to no orders.
No
No steps
ValuesSet stockHeadline to blank.Set stockHeadline to blank.
Decisions & LoopsIf outCount is greater than 0If outCount is greater than 0
Yes
TextBuild the text , @outCount out of stock and save it as stockHeadline.Build the text , @outCount out of stock and save it as stockHeadline.
Else if @runningLowCount is greater than 0
TextBuild the text , @runningLowCount running low and save it as stockHeadline.Build the text , @runningLowCount running low and save it as stockHeadline.
Otherwise
No steps
Decisions & LoopsIf a step below fails, save the error as sendErrorIf a step below fails, save the error as sendError
Try
GmailGmailSend an email to sendTo. Save it as sent.Send an email to sendTo. Save it as sent. Subject: dayName at storeName: salesHeadline@stockHeadlineGood morning, Here is how storeName did yesterday, dayLabel. SALES salesSection TOP 5 PRODUCTS BY UNITS ORDERED ...
On error
Decisions & LoopsStop and report a problem: The brief could not be sent from Gmail, so nobody received it. Check the Gmail connection under Integrations, then run this again. Gmail said: sendError.message.Stop and report a problem: The brief could not be sent from Gmail, so nobody received it. Check the Gmail connection under Integrations, then run this again. Gmail said: sendError.message.
Decisions & LoopsIf unreadCount is greater than 0If unreadCount is greater than 0
Yes
Decisions & LoopsStop and report a problem: Sent the brief to sendTo, but unreadCount of yesterday's orders could not be read from Shopify and unreadVerb left out of the top products: unreadList@unreadMore. Shopify said: lastOrderError.Stop and report a problem: Sent the brief to sendTo, but unreadCount of yesterday's orders could not be read from Shopify and unreadVerb left out of the top products: unreadList@unreadMore. Shopify said: lastOrderError.
No
No steps
Decisions & LoopsFinish the run: Sent the brief for dayLabel to sendTo: salesHeadline, outCount out of stock and runningLowCount running low.Finish the run: Sent the brief for dayLabel to sendTo: salesHeadline, outCount out of stock and runningLowCount running low.