PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.18
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.18
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
← All changes | includes/Products.php +6 -4 1.10.21.10.18 View file →
@@ -208,11 +208,11 @@
208 208 *
209 209 * @param WC_Product $product Product.
210 210 */
211 211 public function save_decimal_quantities( WC_Product $product ): void {
212 + // Without stock management there is no quantity to derive a status from;
213 + // WooCommerce respects the manually chosen stock status, so leave it untouched.
212 214 if ( ! $product->get_manage_stock() ) {
213 - $product->set_stock_status( 'instock' );
214 -
215 215 return;
216 216 }
217 217
218 218 $stock_quantity = $product->get_stock_quantity();
@@ -217,10 +217,12 @@
217 217
218 218 $stock_quantity = $product->get_stock_quantity();
219 219 $stock_notification_threshold = absint( get_option( 'woocommerce_notify_no_stock_amount', 0 ) );
220 220
221 - // Adjust the condition to consider stock quantities between 0 and 1 as instock if greater than 0.
222 - $stock_is_above_notification_threshold = ( $stock_quantity > 0 && $stock_quantity > $stock_notification_threshold );
221 + // Mirrors WC_Product::validate_props() minus its (int) cast on the stock
222 + // quantity, which would truncate fractional stock (e.g. 0.5) to 0 and
223 + // mark it out of stock. Re-check against core on WooCommerce updates.
224 + $stock_is_above_notification_threshold = ( $stock_quantity > $stock_notification_threshold );
223 225 $backorders_are_allowed = ( 'no' !== $product->get_backorders() );
224 226
225 227 if ( $stock_is_above_notification_threshold ) {
226 228 $new_stock_status = 'instock';