WooWeekly #296: Job Offer, Cart Getters

How you doing?

It’s a sunny Wednesday here in Sicily, and officially our 37th day of quarantine in Italy. Finally, we’re in phase 2; some factories and shops reopened yesterday, while schools, restaurants and anything where social distancing can’t be guaranteed is still closed and will be for a long time.

Anyway, welcome back to our WooCommerce Weekly appointment – here comes a series of WooCommerce tutorials put together by yours truly so that you can learn something new.

New WooCommerce Tips

WooCommerce: Get Cart Info (total, items, etc) from $cart Object

As a WooCommerce development freelancer, every day I repeat many coding operations that I keep forgetting over and over again! This means I have to search through the WooCommerce plugin files again and again and waste a lot of precious time. We’ve already seen how to get $product and $order information from their respective objects, so this time we’ll take a look at the Cart page and answer to: “How to get ____ if I have the $cart variable/object available?” For example, “How can I get the cart total”? Or “How can I get the cart items”? Or maybe the cart fees, the applied coupons, the cart contents total, the total weight and so on. Enjoy: https://businessbloomer.com/woocommerce-get-cart-info-total-items-etc-from-cart-object/

Author

  • Rodolfo Melogli

    Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

    View all posts

Proudly supported by

Join them?