Support » Plugins » [Plugin: WooCommerce] Warning: Division by zero

  • Resolved johnsorci


    I am using WooCommerce with the Themeforest X Ultimate WordPress Theme.

    I cannot get the product thumbnails to show on the main shop page or any page. Instead I get this:

    Warning: Division by zero in /home/content/86/7154286/html/doodlesncompany/wp-content/plugins/woocommerce/templates/content-product.php on line 33
    Warning: Division by zero in /home/content/86/7154286/html/doodlesncompany/wp-content/plugins/woocommerce/templates/content-product.php on line 35

    When going into my files, these are the lines it is referencing:

    // Extra post classes
    $classes = array();
    if ( 0 == ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns'] )
    	$classes[] = 'first';
    if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] )
    	$classes[] = 'last';

    I have searched around for answers and nothing that I have found/tried has worked.

    Thanks for any help.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Figured it out.

    Glad you found the resolution. What did it end up being? How did you fix it?

    What was the solution? I have the same issue.



    Forum Moderator

    @gazza777: If you require assistance then, as per the Forum Welcome, please post your own topic.

    Why would I open ANOTHER topic when my problem is EXACTLY the same?

    I am not sure of the etiquette but I also need this resolved. Any tips would be appreciated. I don’t complete understand PHP but I can edit it with some direction.

    I have the same problem here too.

    solved the problem.
    just disable all plugins and delete all products.

    it is the “WooCommerce Customizer” cause the problem. Disable it everything ok.

    For those who are having the problem, you don’t have to modify code or disable the plugin. Within the Customizer, there is a tab that gives WooCommerce Options. Just go in there, choose your settings, save, and the error will go away.

    @tiresias28 Thank You!
    fixed for me.

    hmmm, I wonder what caused it to lose it’s settings in the first place though. scary thought…


    Please share the solution, I am facing the same error.

    on WooCommerce website.

    If I commented this code:

    // Extra post classes
    $classes = array();
    if ( 0 == ( $woocommerce_loop[‘loop’] – 1 ) % $woocommerce_loop[‘columns’] || 1 == $woocommerce_loop[‘columns’] )
    $classes[] = ‘first’;
    if ( 0 == $woocommerce_loop[‘loop’] % $woocommerce_loop[‘columns’] )
    $classes[] = ‘last’;

    And run the site still not working normally. As I uncommented the code and run the site, It works fine but it is not a solution.

    Please advise your test trick that resolve this issue.

    Grateful to you,


    For the sake of anyone who comes to this post looking for an answer I will make clear what is going on because what has been written here tells you the answer but not clearly.

    You do not need to edit any code. You just need to resave some settings.

    The issue comes from using a plugin called WooCommerce Product Archive Customiser

    For some reason when you get to a certain point as you work on your site, (not sure what sets it off) you will find that your Products settings for that plugin have been wiped out. The become blank!

    All you need to do is re-establish (re-save) your settings for that plugin which are found at: WooCommerce>Settings>Products> find the “Product Archives” heading on that page.

    Once you re-establish your settings, click save. The error goes away and your store products are just as before.

    If you are also using the WooCommerce Product Details Customiser plugin, (by the same author) you will also need to check and possibly re-establish “Product Details” settings too.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: WooCommerce] Warning: Division by zero’ is closed to new replies.