h2. Issue description
The SimpleStockLevelFormatter has stopped working. Looks like the issue is as a result of an empty array $items passed in to the function. probably related to changes in the calculated field and needs investigation.

h2. Original issue report
The stock field is visible in "product variations, manage form display"
The stock field is active in "product variations, manage display" but the product variation does not show this on the view page.

I can to create a view with stock, but the there is no relationship with commerce products available.

Creating a view for e-commerce products there is a field stock but does not show values.
Here there is no method to add a stock relationship, nothing shows up in relationships.

How should the stock level be made visible on a product page and in views? I have

I use the the up to date modules (as found on 1 dec 2017).

Comments

Cheviot created an issue. See original summary.

Cheviot’s picture

Issue summary: View changes
guy_schneerson’s picture

Title: Stock level field not showing in product variations on the buy-item product page » SimpleStockLevelFormatter has stopped working
Category: Support request » Bug report
Issue summary: View changes
Priority: Normal » Major
guy_schneerson’s picture

Thanks Cheviot for reporting

guy_schneerson’s picture

  • guy_schneerson committed ca8a1aa on 8.x-1.x
    Issue #2899747 by guy_schneerson: SimpleStockLevelFormatter has stopped...
guy_schneerson’s picture

Status: Active » Fixed

The issue was that Drupal 8 computed field support was not complete and it ended up storing values in the database and $items in viewElements() was not empty.
I suspect that it no longer stores the values and we can now ignore the empty$items return a single element, holding the stock level.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.