PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
← All changes | app/Modules/Data/ProductQuery.php +4 -4 1.3.23 → 1.6.5 View file →
@@ -30,8 +30,9 @@
30 30 'page' => 1,
31 31 'cursor' => null,
32 32 'product_type' => '', // physical|digital|subscription|onetime|simple|variations
33 33 'stock_status' => '', // in_stock|out_of_stock // check only if global stock management is enabled
34 + 'allow_out_of_stock' => false, // when false, show only in-stock products
34 35 'min_price' => 0,
35 36 'max_price' => 0,
36 37 'on_sale' => false,
37 38 'is_main_query' => false,
@@ -124,12 +125,11 @@
124 125 })
125 126 ->when($this->queryArgs['exclude_ids'], function ($query, $excludeIds) {
126 127 $query->whereNotIn('ID', $excludeIds);
127 128 })
128 - //TODO: check if stock management module is on
129 - ->when($this->queryArgs['stock_status'], function ($query, $stockStatus) {
130 - $query->whereHas('detail', function ($query) use ($stockStatus) {
131 - $query->where('stock_availability', $stockStatus);
129 + ->when(!$this->queryArgs['allow_out_of_stock'], function ($query) {
130 + $query->whereHas('detail', function ($query) {
131 + $query->where('stock_availability', 'in-stock');
132 132 });
133 133 })
134 134 ->when($this->queryArgs['on_sale'], function ($query) {
135 135 $query->whereHas('variants', function ($query) {