3

How can I find customer cart overall weight?

3

You can use this

$cart_weight =  Mage::getSingleton('checkout/session')
    ->getQuote()
    ->getShippingAddress()
    ->getWeight();
  • Its working good, how can i display this option for only selected customer like using customer id. – zus Apr 10 '18 at 8:02
  • This code should get the quote from the checkout session, So this will always display current customer cart weight – WISAM HAKIM Apr 10 '18 at 12:50
  • Okay, is any possible to show this option only for selected IP Address customer only. We don't need to display for all customer. – zus Apr 12 '18 at 5:01
  • Yes of course, you can but you need to use pure PHP code , <?php if($_SERVER["HTTP_X_REAL_IP"] == "{ip}"):?> <?php endif; ?> OR <?php if($_SERVER["REMOTE_ADDR"] == "{ip}"):?> <?php endif; ?> – WISAM HAKIM Apr 12 '18 at 11:57
  • Pls check my code right :: justpaste.it/1jk26 – zus Apr 13 '18 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.