WooWeekly #312 (Beach Edition): Getters

How you doing?

It’s a busy summer Wednesday here in Sicily… I apologize for missing the last two newsletters – I’ve got very used to my time off. I hope I’m able to get back to full time in September… it will be very hard!

Anyhow, welcome back to WCWeekly – in this “Beach Edition” I will cover one WooCommerce topic, so that you can improve your knowledge around that.

Stay safe and be happy!

The Importance of “Getting” The Values You Need

The most difficult thing (at least at the very beginning of someone’s WooCommerce dev career), is “getting” stuff. What I mean, for example, is “getting the product title”, “getting the order total”, “getting the cart items”, and so on.

Basically, based on where you are in WooCommerce (backend / frontend) and what you need (cart, order, product info), you always need to find a way to “get” what you need.

Thankfully, WooCommerce came up with “getters” PHP function. These are coded so that you can “get” whatever you like from inside a PHP variable. If you “have access” to the $order variable, you can “get the order billing address”. If you have access to the $product variable, you can for example “get the product price”. And so on…

Because remembering all these getters is impossible, I built three developer tutorials, one for each “section”:

URLs should be self-explanatory. If you customize WooCommerce, even a little, even if you’re a beginner, sooner or later you’ll need to bookmark these 3 resources.

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?