Support » Plugin: Cost of Goods for WooCommerce » Bug – unable to make an order

  • Resolved artipixel

    (@artipixel)


    First – Thank you for a great plugin!
    There is a little issue –
    When trying to order and pay (paypal, but it happens in every payment method)
    Getting 500 error from XHR?wc-ajax=checkout:

    [24-Jan-2021 10:30:23 UTC] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /home/customer/www/[deducted]]/public_html/wp-content/plugins/cost-of-goods-for-woocommerce/includes/class-alg-wc-cog-orders.php:663
    Stack trace:
    #0 /home/customer/www/[deducted]]/public_html/wp-content/plugins/cost-of-goods-for-woocommerce/includes/class-alg-wc-cog-orders.php(347): Alg_WC_Cost_of_Goods_Orders->update_order_items_costs(3260, false)
    #1 /home/customer/www/[deducted]]/public_html/wp-includes/class-wp-hook.php(287): Alg_WC_Cost_of_Goods_Orders->save_cost_input_shop_order_save_post(3260, Object(WP_Post), false)
    #2 /home/customer/www/[deducted]]/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #3 /home/customer/www/[deducted]]/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #4 /home/customer/www/[deducted]]/public_html/wp-includes/post.php(4298): do_action('save_post_shop_...', 3260, Object(WP_Post), false)

    I’ve fixed it again with typecasting, maybe you should consider testing those problematic places where there is a potential to types error, as I’ve opened last week a bug with the same problem…

    A quick fix:
    – in the file cost-of-goods-for-woocommerce/includes/class-alg-wc-cog-orders.php replace lines 662-664 with:

    				$_shipping    = (float) apply_filters( 'alg_wc_cog_order_shipping_total', $order->get_shipping_total(), $order );
    				$profit      += (float) $_shipping;
    				$total_price += (float) $_shipping;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.