Michaela Merz's personal blog site

Looking Into Woo-Commerce

Everybody – well – almost everybody loves WordPress. And with the WooCommerce plugin you can make it into a full blown shopping site – for free. However – extensions for WooCommerce come with a price tag. Time to take a look at it..

WooCommerce is – in itself- a pretty powerful plugin. It can easily run even a more complex shopping site as it comes with all functionality needed – including product and shipping management, variations, categories, inventory and more.

WooCommerceThat’s really great and I applaud the creators for their product. But at one point or another, you discover that you need even more functionality. And the right addon might not be available or expensive. I had two needs: The ability to export order lists and customer data. I don’t trust WordPress (or any other online software) to keep customer data safe – so I export and delete the online data in regular intervals. Second – I wanted to interface some external download mechanics to WooCommerce.

As WooCommerce is integrated into WordPress, it uses WP’s databases to store it’s stuff. And that was a bit confusing. Products and orders are stored in the “posts” database. Look for the

post_type=”publish” and “post_parent=0” fields

to get only published products. Meta-data for the products and orders (e.g. the SKU, customer data) are stored in postmeta, however some information (e.g. the status of an order) is in the “posts” database, while other spefics about the order can be found in the “woocommerce_order_items” and “woocommerce_order_itemmeta” tables.

So with just a little PHP magic, you can easily build your own extensions accessing the woocommerce products and orders. In my case, I was able to create a downloader module that requires the customers email-address and the order id to allow access to purchased downloads by retrieving and verifying the relevant Woocommerce data entries.

Problem solved.

Leave a Reply

Your email address will not be published. Required fields are marked *