SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
744 stars 389 forks source link

Product with 'force in stock' stock status is shown as out of stock #5106

Closed kate1zheng closed 5 years ago

kate1zheng commented 5 years ago

Environment Details

Steps to Reproduce

  1. change the stock status as force in stock image
  2. go to PDP for this product

Observed Results

the product is shown as out of stock image

Expected Results

should show 'available online' like on-premise

Repository Used

Offer to Fix

Additional Information

kate1zheng commented 5 years ago

when setting the stockstatus as 'force in stock', the response is: "stock" : { "stockLevelStatus" : "inStock" }, when setting the stock status as 'not specified', the response is: "stock" : { "stockLevel" : 22, "stockLevelStatus" : "inStock" },

however, in add-to-cart component, the stock logic is this.hasStock = product.stock && product.stock.stockLevelStatus !== 'outOfStock' && product.stock.stockLevel > 0; it doesn't consider the situation 'force in stock'

KateChuen commented 5 years ago

Investigate if it's a spartacus issue or if we need to request an update in the api.

josecervera commented 5 years ago

+1 Besides, in SAP Commerce, if you don't associate any warehouse to the basestore, it will generate by default a stock with StockLevel == 0 (see de.hybris.platform.commercefacades.product.converters.populator.StockPopulator), so the condition on (product.stock.stockLevel > 0) fails.

bgambocjaviniar commented 5 years ago

Looks like it fixed:

QA:

When changing the stocks, it takes a while before it updates its in the backend. Wait ~45s and refresh the product page or navigate to it if you closed it.

KateChuen commented 5 years ago

Tested it on dev10 with hybris-commerce-suite-1905.6.zip (and develop branch of spartacussampledataaddon and commercewebservicesdata).

It is working like you describe it.

Screen Shot 2019-11-15 at 2 52 15 PM