• Resolved bjornroiverhogen

    (@bjornroiverhogen)


    When activating the section for Min and/or Max Qty the product page returns a 503 error page with the following error log:

    PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /home/[redacted]/domains/[redacted]/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php on line 883

    PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

    Both Woocommerce and Booster are on the latest version, as is my WP version and Theme version. A plugin conflict test does not solve the issue unless Min/Max Qty sections are disabled.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor David G

    (@gravid7)

    Hi @bjornroiverhogen,

    Thank you for reaching out.

    Could you please share some screenshots of your configuration settings? This will help us replicate the issue on our end and assist you more effectively in resolving it.

    Thread Starter bjornroiverhogen

    (@bjornroiverhogen)

    Hi @gravid7 ,

    Sure thing. Nothing unusual as far as I’m aware. I tried a plugin conflict test and emptied my functions.php so no custom was interfering.

    https://gyazo.com/7d08eaad34557e0495849f2b940ad83a

    https://gyazo.com/b96f0309f94ae4cbe791706ad5ac57c9

    https://gyazo.com/74ab63bd8c702b662b356a52f9b5b943

    https://gyazo.com/3cc08237c640ce1c98604db631fe01f7

    https://gyazo.com/75a893c57d16a5cedab6d005dca7f282

    Thread Starter bjornroiverhogen

    (@bjornroiverhogen)

    Hi @gravid7 ,

    Any news on this?

    Plugin Contributor David G

    (@gravid7)

    Hi

    We’ve logged this as a confirmed bug and will include the official fix in the upcoming Booster update.

    In the meantime, if you’d like to apply the patch manually to prevent the crash right away, please follow the steps below:

    File path (depending on your installed booster version):

    If you are using booster elite version

    /wp-content/plugins/booster-elite-for-woocommerce/includes/class-wcj-order-quantities.php

    If you are using booster plus version

    /wp-content/plugins/booster-plus-for-woocommerce/includes/class-wcj-order-quantities.php

    If you are using booster free version

    /wp-content/plugins/woocommerce-jetpack/includes/class-wcj-order-quantities.php

    Locate this function: "set_quantity_input_max"

    Note : Before making any changes, please back up the original file to avoid any potential issues.

    Replace it with the following code:

    public function set_quantity_input_max( $qty, $_product ) {

        // Prevent recursion to avoid memory exhaustion

        static $depth = 0;

        if ( $depth > 0 ) {

            return $qty;

        }

        $depth++;

        // Handle variable products normally

        if ( $_product->is_type( 'variable' ) ) {

            $depth--;

            return $qty;

        }

        // Apply Booster max logic

        $plugin_max = $this->get_product_quantity( 'max', $_product, $qty );

        $wc_max     = $_product->get_max_purchase_quantity();

        $depth--;

        // Return the correct limit

        return ( -1 === $wc_max || $plugin_max < $wc_max ) ? $plugin_max : $wc_max;

    }

    This fix will be officially included in our upcoming update so that no manual patch will be required going forward.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Fatal error when Order Quantities is activated’ is closed to new replies.