Home › Forums › Cost of Goods for WooCommerce › Error on product variants with empty cost field
- Support forum for the Cost of Goods for WooCommerce.
- This topic has 1 reply, 2 voices, and was last updated 2 months ago by Moshtafizur.
January 17, 2023 at 4:32 pm #107739MarkParticipant
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”.
January 17, 2023 at 5:44 pm #107744MoshtafizurModeratorPlugin Support
- This topic was modified 2 months ago by Mark. Reason: Added solution
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.
- You must be logged in to reply to this topic.