Error on product variants with empty cost field

Top WooCommerce & WordPress Plugins Forums Cost of Goods for WooCommerce Error on product variants with empty cost field

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #107739
    Mark
    Participant

    There seems to be an error in class-alg-wc-cost-of-goods-core.php:

    We had several product variants with empty cost fields that blocked all WooCommerce tabs and fields from responding once saved. In the function get_variable_product_html():725 you gather the costs for the variants, but do not check if values are zero/” or null. The calculations $value / $cost therefore produce an “Can’t divide by zero” or similar error.

    Temporarily fixed by adding ‘$cost > 0 && ‘ in the condition on line 751.

    Found in version 1.7.2 of “Cost of Goods for WooCommerce Pro” via “wc-logs/fatal-errors.log” as “unsupported operand types string / string in class-alg-wc-cost-of-goods-core.php in line 753”.

    • This topic was modified 1 year, 2 months ago by blankMark. Reason: Added solution
    #107744
    blankMoshtafizur
    Moderator
    Plugin Support

    Hi Mark,

    I hope you’re doing well today. I understand that you’ve been experiencing some issues with the Cost of Goods plugin. I apologize for any inconvenience this has caused you.

    Based on the information provided, it appears that you may be using an outdated version of the plugin. To help resolve the issue, I would recommend that you update the plugin to the latest version, which is version 2.8.6. You can download the latest version of the plugin from this link.

    Once you’ve completed the update, please let me know if the issue persists. I’ll be more than happy to assist you further.

    Best regards,
    Moshtafizur

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.