Skip to content

Commit

Permalink
Merge pull request #22 from liamgold/hotfix/in-stock-wording
Browse files Browse the repository at this point in the history
Correct wording of In Stock
  • Loading branch information
michalJakubis authored Sep 25, 2024
2 parents d04a007 + a806dc4 commit e9c55d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Kentico.Xperience.Shopify/Products/ShopifyProductService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,18 @@ private async Task<Dictionary<string, ProductVariantListModel>> GetVariantsFromA
private ProductVariantListModel GetVariantListModel(ProductVariant variant, string currencyCode, Dictionary<long, InventoryItem> inventoryItems)
{
var prices = variant.PresentmentPrices.First();
bool onStock = true;
bool inStock = true;
if (inventoryItems.TryGetValue(variant.InventoryItemId ?? 0, out var inventoryItem))
{
onStock = !(inventoryItem.Tracked ?? false) || variant.InventoryQuantity > 0;
inStock = !(inventoryItem.Tracked ?? false) || variant.InventoryQuantity > 0;
}
return new ProductVariantListModel()
{
PriceFormatted = prices.Price.Amount.FormatPrice(currencyCode),
ListPriceFormatted = prices.CompareAtPrice?.Amount.FormatPrice(currencyCode),
StockCssClass = onStock ? "available" : "unavailable",
StockStatusText = onStock ? "On stock" : "Out of stock",
Available = onStock,
StockCssClass = inStock ? "available" : "unavailable",
StockStatusText = inStock ? "In stock" : "Out of stock",
Available = inStock,
MerchandiseID = variant.AdminGraphQLAPIId,
};
}
Expand Down

0 comments on commit e9c55d2

Please sign in to comment.