• After update to WC 3.0.x, at checkout with variable products, I receve this error: “Invalid product.”, but the order it’s still recorded in database, widouth notify user or admins.

    I soupose it’s comming from read method from class-wc-product-data-store-cpt.

    I’m not sure why those conditions throw this error for variable products.

    Maybe because variation post_type in DB are “product_variation” and that condition check “‘product’ !== $post_object->post_type”

    • This topic was modified 7 years, 7 months ago by Alin Ionut.
Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the same issue. Any luck solving it?

    Thread Starter Alin Ionut

    (@c3dry2k)

    Nop, restore backup files + db

    I’m having the same issue as well. Does anyone know a fix, or lead me in the right direction.

    Thread Starter Alin Ionut

    (@c3dry2k)

    I took my time today to put my website on localhost and start debugging this.

    Bottom line, found my problem on a custom hook method:

    
    $order = new WC_Order(here_order_id_from_hook);
    foreach ($order->get_items() as $order_products) {
        $product_variation_id = $order_items_single['variation_id'];
           if ($product_variation_id) {
                $product = new WC_Product($product_variation_id);
            } else {
                $product = new WC_Product($order_items_single['product_id']);
            }
    }
    

    If the product is variable, is not working anymore like this. My new code replace $product_variation_id with $order_items_single[‘product_id’] and it’s fine now.

    Basically, this check is not necessary, for me.

    • This reply was modified 7 years, 6 months ago by Alin Ionut.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘“Invalid product.” error at checkout variable products’ is closed to new replies.