• Resolved ashu2982

    (@ashu2982)


    Hi,
    I just installed your plugin as it does what i exactly need.
    I was checking how it works so i added incremental quantity to product and proceed to checkout then i went back to same product page decrease the quantity and clicked add to cart button and BOOM it gave error message and then site goes blank with just ‘error’ showing on screen.

    Warning: Division by zero in /home/*********/wp-content/plugins/woocommerce-incremental-product-quantities/product-quantity-validations.php on line 137
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/*********/wp-content/plugins/woocommerce-incremental-product-quantities/product-quantity-validations.php:137) in /home/********/wp-includes/pluggable.php on line 876

    Please take a look at error message and if possible please fix this error asap because this plugin was the only reason that i didn’t switch to another shopping cart.

    Thanks in advance.

    https://www.ads-software.com/plugins/woocommerce-incremental-product-quantities/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter ashu2982

    (@ashu2982)

    An update to my problem.
    Just figured out that the site goes blank with ‘error’ message was because of Better WP Security Plugun. It says ‘Site is locked down due to too many attempts to open a file that does not exist.’ though every time this lock down came after the error in plugin.

    Thread Starter ashu2982

    (@ashu2982)

    Ok i deleted these lines in product-quantity-validations.php and so far plugin is working great.
    I am sorry but i don’t have much knowledge about php and wp programming so i am completely unaware of what it does. Please let me know if there is any other alternative.

    if ( $step != null && $cart_qty_rem % step != 0 ) {
    $woocommerce->add_error( sprintf( __(“You may only purchase %s in multiples of %s.”, ‘woocommerce’ ), $title, $step ) );
    return false;
    }

    I am not marking this question as resolved because i know deleting code written by author is definitely not a solution ??

    Hm, personally I’m unable to replicate the error but based on your error try replacing what you removed with this:

    // Total Cart Quantity Step Validation
    if ( $step != null && $step != 0 && $cart_qty_rem != 0 && $cart_qty_rem % $step != 0 ) {
    $woocommerce->add_error( sprintf( __(“You may only purchase %s in multiples of %s.”, ‘woocommerce’ ), $title, $step ) );
    return false;
    }

    This shouldn’t run the validation if $step or $cart_qty_rem = 0 meaning you shouldn’t get a division by 0 error.

    Please let me know so I can push the changes to the repo, thanks!

    Thread Starter ashu2982

    (@ashu2982)

    Yes this worked. Now i am not getting any error after updating your code.

    Thanks for your help. This plugin definitely deserve 5 Star from me ??

    Great!

    Glad you enjoy it.

    Hi i installed the plugin onto my site but when i activate the plugin all i get when trying to edit a product is the description and a bar that says Quantity rules the problem is that i’m not able to expand that bar so i’m left with no way to update pricing, short description or pretty much anything under the Description box. Help me please.

    Are you still having that issue atejena?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin gives error when we update product which is already added to cart.’ is closed to new replies.