• Getting errors from woocommerce error logs some time.
    Following is the error log.

    2020-05-01T00:17:16+00:00 CRITICAL Uncaught Error: Call to a member function get_tax_class() on null in wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:223
    Stack trace:
    #0 wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(650): WC_Cart_Totals->get_items_from_cart()
    #1 wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(141): WC_Cart_Totals->calculate_item_totals()
    #2 wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(132): WC_Cart_Totals->calculate()
    #3 wp-content/plugins/woocommerce/includes/class-wc-cart.php(1237): WC_Cart_Totals->__construct(Object(WC_Cart))
    #4 wp-content/plugins/woocommerce/includes/class-wc-cart.php(1196): WC_Cart->calculate_totals()
    #5 wp-content/plugins/woo-fly-cart/wpc-fly-cart.php(732): WC_Cart->set_quantity(‘5beaa0225a3fb38…’, 0)
    #6 wp-includes/class-wp in wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 223

Viewing 1 replies (of 1 total)
  • Plugin Author WPClever

    (@wpclever)

    Thank you for informing us of this issue!

    Please change function woofc_update_qty() {…} to:

    function woofc_update_qty() {
        if ( isset( $_POST['cart_item_key'], $_POST['cart_item_qty'] ) ) {
            if ( (float) $_POST['cart_item_qty'] > 0 ) {
                WC()->cart->set_quantity( $_POST['cart_item_key'], (float) $_POST['cart_item_qty'] );
            } else {
                WC()->cart->remove_cart_item( $_POST['cart_item_key'] );
            }
    
            $cart = array( 'action' => 'update_qty' );
            echo json_encode( $cart );
    
            die();
        }
    }

    Or just wait for us, we’ll release an updated version soon.

Viewing 1 replies (of 1 total)
  • The topic ‘Getting error from WC_Cart->set_quanitty’ is closed to new replies.