cocart-headless / cocart-products-api

Provides a public view of the products on store for CoCart.
https://cocart.xyz
1 stars 0 forks source link

[Enhancement]: Override stock details if global stock management is used but no variations are created #18

Open seb86 opened 10 months ago

seb86 commented 10 months ago

Describe the solution you'd like

It is unlikely a variable product will not have any variations applied but should such a product be published without any, the stock details are not returning correctly should the global stock management be used.

Need to override the following stock values from this:

"stock": {
        "is_in_stock": true,
        "stock_quantity": 5,
        "stock_status": "instock",
        ...
}

to this:

"stock": {
        "is_in_stock": false,
        "stock_quantity": null,
        "stock_status": "outofstock",
        ...
}

Describe alternatives you've considered

No response

Additional context

No response