Stock enforcement - context - product not in current store

Created on 20 November 2020, almost 5 years ago
Updated 26 October 2025, 13 days ago

Hello,

Problem/Motivation

To check if a product is in stock, there is a function thas create the context : commerce_stock_enforcement_get_context
This function check if the product is in the current store. If not, it take another store of the product.
Doing that, a product that can't be order in that store can be set in the cart if it is in stock in another store.

Proposed resolution

In my use case, (and maybe in general ?), a product witch is not in a store should be considered out of stock.
I propose the function commerce_stock_enforcement_get_context return false when the product is not in the stock. And each time this function is called, if it returns false, the stock is considered as empty.

💬 Support request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024