Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ In order to apply CSS customizations in this and other blocks, follow the instru
| `specificationsTableSpecificationHeading` |
| `specificationsTabsContainer` |
| `specificationsTitle` |
| `unavailable` |

<!-- DOCS-IGNORE:start -->

Expand Down
10 changes: 9 additions & 1 deletion react/components/SkuContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useProduct from 'vtex.product-context/useProduct'
import { useProductDispatch } from 'vtex.product-context/ProductDispatchContext'
import classNames from 'classnames'

const CSS_HANDLES = ['skuContentWrapper', 'selectedSkuContentWrapper'] as const
const CSS_HANDLES = ['skuContentWrapper', 'selectedSkuContentWrapper', 'unavailable'] as const

interface Props {
product: Product
Expand All @@ -24,6 +24,10 @@ const SkuContent = ({ item, product, children }: Props) => {
dispatch({ type: 'SET_SELECTED_ITEM', args: { item: item } })
}
}
let available = 0;
item.sellers.forEach((seller) => {
available += seller.commertialOffer.AvailableQuantity;
});
const containerClasses = classNames(
'ba mb3 pa5',
handles.skuContentWrapper,
Expand All @@ -34,6 +38,10 @@ const SkuContent = ({ item, product, children }: Props) => {
{
[`bw1 b--blue ${handles.selectedSkuContentWrapper}`]:
selectedItem.itemId == item.itemId,
},
{
[`${handles.unavailable}`]:
available == 0,
}
)
return (
Expand Down