Posts

Showing posts from April, 2013

Woocommerce how to get order status?

If you are writing plugin (like me) under Woocommerce 2.0 to get a list of order of particular order status, you will find that it does not exists in wp_posts and wp_postmeta.

Simply put:

All order status strings (e.g. completed, failed, on-hold etc) are stored in wp_termsUsing wp_terms.term_id, you can find your order ID in wp_term_relationships.  In this table, order ID is called "object_id"You can now do a search on wp_posts using wp_term_relationships.object_id (wp_term_relationships.object_id is now post_id) You don't need to write SQL to do the above 3 steps, Wordpress has already provided similar functions to do this.  They are get_term_by and get_objects_in_term.  Sample code below:

$status = get_term_by( 'slug', sanitize_title( $_POST['order_status'] ), 'shop_order_status' );
$s = get_objects_in_term($status->term_id, 'shop_order_status');
var_dump($s);

It will return order IDs in array, like:

array
0 => string '1457&…

MaryEllen Tribby 10 Keys To A Great Offer

Some notes from this podcast in ILoveMarketing.com.  The 10 keys to a GREAT OFFER by MaryEllen Tribby:

Ask yourself, is your offer:

SpecificExclusiveValuableUniqueUsefulRelevantPossibleEasy to acquireUrgentGuarantee If your offer matches all 10 keys here, you have a great offer.
Always write your copy first, write all your ideas down, and create your product.