Today I’ll be covering the second part in my beginner’s WooCommerce series if you haven’t had the chance to look at the previous post. I suggest you do that here. In that post I’ve covered the general ideas behind WooCommerce. In this post I would like to write about my experiences and give a developers looking to delve into WooCommerce a head start.
There’s a very good video series for WooCommerce that covers the basics of setting up your store. For any novices out there i suggest you take the time and have a good look through these. There are a lot of things that come out of the box with WooCommerce that you may unknowingly spend hours building only to find out that it could be done with a simple click of a checkbox(believe me I know). Videos, I Find always help, they’ll take less time to read than the entire documentation and put you in good stead when you’re done.
Now since we’ve covered what is WooCommerce, let us cover how Woo works in the context of WordPress. Once you’ve got WooCommerce installed on your system you get two distinct portions categorized by two new Admin Menu items, namely WooCommerce and Products.
- The Products menu, gives you the ability to add, categorize and manage your products.
- Through the WooCommerce menu, you’re given access to
Of all of these as a developer I consider the settings options most essential as here is where you’ll be either adding options for shipping, tax, payment gateways etc. So i would urge you to understand what and where those 3 portions are under the settings menu. This will save you a huge amount of time, pointlessly googling and clicking on links to find a simple menu.
I’ll be now going through the Products section in deeper detail:
WooCommerce Products are custom post types, for anyone not familiar with the terminology please have a look here.
By default WooCommerce Products are registered as post_type = product, has custom taxonomies product_cat and product_tax. All wordpress queries you would do for Custom Post Types you can do with your Products this makes WooCommerce very flexible.
There are 4 product types that come out of the box with Woo, they are:
- External or Affiliate
Product types are also defined as custom taxonomy, product_type. Meaning each product type also categorizes your products. So you could do a simple tax_query and list all ‘Simple Products’ under Category of ‘Nepal’ in a custom loop if you wanted.
$tax_query = array( array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => 'simple' ), array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => 'nepal' ), ); $args = array( 'post_type' => 'product', 'tax_query'=>$tax_query, 'posts_per_page' => -1, ); $simpleProducts = new WP_Query($args); while( $simpleProducts->have_posts() ): $simpleProducts->the_post(); echo get_the_title(); endwhile;