Plugin Directory

Changeset 3451158


Ignore:
Timestamp:
01/31/2026 08:38:00 PM (3 weeks ago)
Author:
modulux
Message:
  • Fix: If no threshold set for new products, QTY shown is wrong and no limit on purchasable quantity.
Location:
visible-stock-threshold-for-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • visible-stock-threshold-for-woocommerce/trunk/readme.txt

    r3399914 r3451158  
    44Tags: woocommerce, threshold, out of stock, availability, role based
    55Requires at least: 5.8
    6 Tested up to: 6.8
     6Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 1.0.0
     8Stable tag: 1.1.0
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6969== Changelog ==
    7070
     71= 1.1.0 =
     72* Fix: If no threshold set for new products, QTY shown is wrong and no limit on purchasable quantity.
     73
    7174= 1.0.0 =
    7275* Initial public release: visible stock cap, Strict Mode, per-product/category/role/global, server validations, i18n.
     
    7477== Upgrade Notice ==
    7578
     79= 1.1.0 =
     80* Fix: If no threshold set for new products, QTY shown is wrong and no limit on purchasable quantity.
     81
    7682= 1.0.0 =
    7783First release.
  • visible-stock-threshold-for-woocommerce/trunk/visible-stock-threshold-for-woocommerce.php

    r3399914 r3451158  
    33 * Plugin Name:  Visible Stock Threshold for WooCommerce
    44 * Description:  Show a capped "visible stock" and limit purchase quantity using global / category / role / per-product thresholds. Strict Mode can mark stock ≤ threshold as Out of Stock. Includes customizable "Only {qty} left" message.
    5  * Version:      1.0.0
     5 * Version:      1.1.0
    66 * Author:       Modulux
    77 * Author URI:   https://modulux.net
     
    366366
    367367        // 1) Per product
    368         $p = (int) $product->get_meta(self::META_KEY, true);
     368        /*$p = (int) $product->get_meta(self::META_KEY, true);
     369
    369370        if ($p > 0 || $p === 0 && $product->meta_exists(self::META_KEY)) {
    370371            return (int) apply_filters('modulux_vst_resolved_threshold', $p, $product);
    371         }
     372        }*/
     373        $meta_val = $product->get_meta(self::META_KEY, true);
     374        if ($meta_val !== '' && $meta_val !== null) {
     375            $p = (int) $meta_val;
     376            if ($p > 0) {
     377                return (int) apply_filters('modulux_vst_resolved_threshold', $p, $product);
     378            }
     379        }           
    372380
    373381        // 2) Role override
Note: See TracChangeset for help on using the changeset viewer.