global $wpdb,$productname,$quantity,$total,$price,$product;
global $woocommerce,$product;
foreach($items as $item => $values) {
    $cart_contents_count =  WC()->cart->get_cart_contents_count();
    if($cart_contents_count !=0){
        $productname = $values['data']->get_title();
        $productweight = $values['data']->get_weight();
        $quantity = $values['quantity'];
        $total = WC()->cart->subtotal;
        $price = $values['data']->get_price();

I want to insert product name,productweight, quantity,total,price into database.
in the table every values inserted correctly but $productweight is always 0.
Can anyone help me please?

Read more here: How to get weight of the single product in woocommerce?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: