• Resolved decupe

    (@tlgozbey)


    Hi,

    We’re getting a fatal error with Maximum Quantity for WooCommerce v2.3 during cart validation:

    PHP Fatal error: Uncaught Error: Call to a member function get_meta() on false
    in …/wp-content/plugins/woocommerce-max-quantity/woocommerce-max-quantity.php:132

    Abbreviated backtrace:

    • wc_get_product_max_limit() — line 132
    • wc_max_qty_update_cart_validation() — line 332 (hooked to woocommerce_update_cart_validation)
    • theme mini-cart → admin-ajax.php

    Root cause: in wc_get_product_max_limit( $product_id ), wc_get_product( $product_id ) can
    return false (e.g. a cart item referencing a product/variation that no longer exists), and the
    next line calls $product->get_meta( ‘_isa_wc_max_qty_product_max’ ) on that false value.

    Suggested fix:
    $product = wc_get_product( $product_id );
    if ( ! $product instanceof WC_Product ) {
    return false;
    }
    $qty = $product->get_meta( ‘_isa_wc_max_qty_product_max’ );

    Environment: WordPress 7, WooCommerce 10.8, PHP 8.4, plugin v2.3 (latest). Logic-level bug
    (not PHP-version specific); it breaks the cart for the affected session.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Marco Almeida | Webdados

    (@webdados)

    Fixed in version 2.4 (that will be released to sites in about 24 hours, because of the new way WordPress.org handles plugin updates)

    Thank yoyu @decupe

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.