• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

Get weight attribute from cart

General Discussion
3
4
250
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    DaniDen last edited by 28 Feb 2021, 16:32

    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

    1 Reply Last reply Reply Quote 0
    • devansh-webkul
      devansh-webkul last edited by 1 Mar 2021, 13:55

      Hi @DaniDen,

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

      $item->weight

      1 Reply Last reply Reply Quote 0
      • 5 months later
      • R
        rudiculous last edited by 19 Jul 2021, 06:02

        @devansh-webkul is there any way to get the total weight of the cart?
        or the only way is to loop over all the cart_items and sum it up?

        1 Reply Last reply Reply Quote 0
        • devansh-webkul
          devansh-webkul last edited by 19 Jul 2021, 06:25

          Loop it and sum it.

          1 Reply Last reply Reply Quote 0
          1 out of 4
          • First post
            1/4
            Last post