Recent Topics

Get weight attribute from cart



  • Hello, In cart db I have weight, can I get this attribute from cart?
    I tried this function in toArray

    $data['payment'] = $cart->payment->toArray();
    
            $data['items'] = $cart->items->toArray();
    
            $data['weight'] = $cart->weight->toArray();
    

    For example for address I have $cart->shipping_address
    But for weight exist?

    Please give me some advice on how to proceed



  • Hi @DaniDen,

    You need to fetch cart_items from cart. Then grab weight attribute.

    $item->weight


Log in to reply