WooCommerce: Get Product / Order Cross-Sells

Getting the list of cross-sells for a WooCommerce product is actually super easy (yes, it’s one line of PHP). But what if you need to “calculate” the list of cross-sells for an entire order, made of different products?

In this short tutorial for developers we’ll see both: how to get the cross-sell IDs for a product, and how to get the entire range of cross-sells based on what’s been purchased in a given order. Enjoy!

Continue reading WooCommerce: Get Product / Order Cross-Sells

WooCommerce: Get All Shipping Zones & Rates

As an advanced WooCommerce developer, at some stage you’re really going to need this PHP function, the same way you often browse through Business Bloomer’s WooCommerce visual hook guides or the product / order / cart getters.

This time we go study how to “get” the shipping zones and rates, because it’s likely that you will need to loop through them when you need to display shipping rates somewhere, or for other custom functionalities. Enjoy!

Continue reading WooCommerce: Get All Shipping Zones & Rates

WooCommerce: See What’s Inside the Order Array (print_r)

When coding in PHP for WooCommerce, sometimes you’ll need to know what’s inside the “Order Array”, so that you can use its elements to print some custom message on the thank you page, or maybe modify its default behaviour.

There is a great PHP function that helps a lot – it’s called print_r() and you can use this to “see” what’s inside the order array ๐Ÿ™‚ Continue reading WooCommerce: See What’s Inside the Order Array (print_r)