Plugin Directory

Changeset 3286755


Ignore:
Timestamp:
05/03/2025 12:17:01 PM (11 months ago)
Author:
storeplugin
Message:

Updated Version 1.6.0

Location:
minmax-quantities-for-woocommerce
Files:
43 added
3 edited

Legend:

Unmodified
Added
Removed
  • minmax-quantities-for-woocommerce/trunk/README.txt

    r3190138 r3286755  
    33Tags: woocommrce quantity, product quantity, quantity, minimum quantity, maximum quantity
    44Requires at least: 3.0.1
    5 Tested up to: 6.7
    6 Stable tag: 1.5.0
     5Tested up to: 6.8.1
     6Stable tag: 1.6.0
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    1414MinMax Quantities for WooCommerce help you to restrict minimum and maximum quantity for product. You can set the restriction globally, as well as individual product including variations. You can also set amount and quantity limits for cart and order.
    1515
    16 👉 [Variations as Single Product Feature](https://storeplugin.net/plugins/minmax-quantities-for-woocommerce/?utm_source=wporg&utm_campaign=minmax&utm_medium=link) | [Support](https://storeplugin.net/contact-us/) | [Purchase Pro](https://storeplugin.net/plugins/minmax-quantities-for-woocommerce/?utm_source=wporg&utm_campaign=minmax&utm_medium=link)
     16👉 [Min Max Quantity Feature](https://storeplugin.net/plugins/minmax-quantities-for-woocommerce/?utm_source=wporg&utm_campaign=minmax&utm_medium=link) | [Support](https://storeplugin.net/contact-us/) | [Purchase Pro](https://storeplugin.net/plugins/minmax-quantities-for-woocommerce/?utm_source=wporg&utm_campaign=minmax&utm_medium=link)
    1717
    1818== Key features: ==
     
    4545* [Advanced Custom Order Status for WooCommerce](https://wordpress.org/plugins/advanced-custom-order-status-for-woocommerce/) - Create, edit, delete or add new custom order statuses and trigger the custom emails when order status changes
    4646* [Product Search for WooCommerce](https://wordpress.org/plugins/product-search-for-woocommerce/) - Search products by SKU, title, category, attributes, tags, and custom taxonomies.
    47 * [ShopElement](https://wordpress.org/plugins/shopelement/) - Elementor Addon for WooCommerce
     47* [WooCommerce Product Table Builder](https://wordpress.org/plugins/product-table-builder-lite/) - Create product table with Drag-and-Drop Table Builder, filter, sorting, pagination and more.
    4848
    4949== Screenshots ==
     
    5757
    5858== Changelog ==
     59= 1.6.0 =
     60* Fix: Minimum, Maximum quantity for cart
     61* Fix: step control for cart
     62* Other: Compatible with WordPress 6.8.1
     63* Other: Compatible with WooCommerce 9.8.3
     64
    5965= 1.5.0 =
    6066* Update: WooCommerce HPOS compatibility
  • minmax-quantities-for-woocommerce/trunk/includes/Clients/Clients.php

    r3012806 r3286755  
    3131        \add_action( 'woocommerce_check_cart_items', [ $this, 'wc_check_cart_items' ], 10, 1 );
    3232        \add_filter( 'gettext_woocommerce', [ $this, 'checkout_error_messege' ] );
     33
     34        // Block api compatible hooks
     35        \add_filter( 'woocommerce_store_api_product_quantity_maximum', array( $this, 'wc_qty_maximum' ), 10, 2 );
     36        \add_filter( 'woocommerce_store_api_product_quantity_minimum', array( $this, 'wc_qty_minimum' ), 10, 2 );
     37        \add_filter( 'woocommerce_store_api_product_quantity_multiple_of', array( $this, 'wc_qty_multiple_of' ), 10, 2 );
    3338    }
    3439
     
    173178
    174179    /**
     180     * Updating quantity max input value on the cart page
     181     *
     182     * @param int         $maximum The max range of the input field.
     183     * @param \WC_Product $product The cart products.
     184     *
     185     * @return int
     186     */
     187    public function wc_qty_maximum( $maximum, $product ) {
     188        $quantity_meta = $this->product_quantity( $product );
     189        if ( ! empty( $quantity_meta ) ) {
     190            if ( isset( $quantity_meta['max_item'] ) && $quantity_meta['max_item'] > 1 ) {
     191                $maximum = $quantity_meta['max_item'];
     192            }
     193        }
     194
     195        return $maximum;
     196    }
     197
     198    /**
     199     * Updating quantity min input value on the cart page
     200     *
     201     * @param int         $minimum The min range of the input field.
     202     * @param \WC_Product $product The cart products.
     203     *
     204     * @return int
     205     */
     206    public function wc_qty_minimum( $minimum, $product ) {
     207        $quantity_meta = $this->product_quantity( $product );
     208        if ( ! empty( $quantity_meta ) ) {
     209            if ( isset( $quantity_meta['min_item'] ) && $quantity_meta['min_item'] > 1 ) {
     210                $minimum = $quantity_meta['min_item'];
     211            }
     212        }
     213
     214        return $minimum;
     215    }
     216
     217    /**
     218     * Updating quantity step input value on the cart page
     219     *
     220     * @param int         $multiple_of The step range of the input field.
     221     * @param \WC_Product $product The cart products.
     222     *
     223     * @return int
     224     */
     225    public function wc_qty_multiple_of( $multiple_of, $product ) {
     226        $quantity_meta = $this->product_quantity( $product );
     227        if ( ! empty( $quantity_meta ) ) {
     228            if ( isset( $quantity_meta['step_item'] ) && $quantity_meta['step_item'] > 1 ) {
     229                $multiple_of = $quantity_meta['step_item'];
     230            }
     231        }
     232
     233        return $multiple_of;
     234    }
     235
     236    /**
    175237     * Updating quantity values on frontend html input min max step values
    176238     *
  • minmax-quantities-for-woocommerce/trunk/minmax-quantities-for-woocommerce.php

    r3107159 r3286755  
    66 * Plugin URI:        https://storeplugin.net
    77 * Description:       MinMax Quantities for WooCommerce plugin lets you set minimum and maximum quantities for items, orders, and amounts of the products in your store.
    8  * Version:           1.5.0
     8 * Version:           1.6.0
    99 * Author:            StorePlugin
    1010 * Author URI:        https://storeplugin.net/plugins/minmax-quantities-for-woocommerce
     
    2828 * Currently plugin version.
    2929 */
    30 define( 'WOO_MINMAX_QUANTITIES_VERSION', '1.5.0' );
     30define( 'WOO_MINMAX_QUANTITIES_VERSION', '1.6.0' );
    3131
    3232/**
Note: See TracChangeset for help on using the changeset viewer.