I have been using this code on Woocommerce to show my variation prices and when I updated to Woocommerce 2.0 I noticed database errors showing up in wp-admin/error-log whenever I edited a product. I am not sure if the errors were also happening prior to updating to 2.0 because I wasn't using Woocommerce for long before the update and don't think I checked the error log until today.
The variation prices showed up as expected but the error log would fill up with the following error every time I opened a product for editing. There was an error for every variation associated with the product I was editing.
WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8 for query SELECT postmeta.post_id AS product_id
FROM wp_postmeta AS postmeta
LEFT JOIN wp_posts AS products ON (
products.ID = postmeta.post_id )
WHERE postmeta.meta_key LIKE 'attribute_%'
AND postmeta.meta_value = '12'
AND products.post_parent = made by
include('wp-admin/edit-form-advanced.php'), do_meta_boxes, call_user_func, woocommerce_product_data_box, do_action('woocommerce_product_write_panels'), call_user_func_array, variable_product_type_options, include('/plugins/woocommerce/admin/post-types/writepanels/variation-admin-html.php'), apply_filters('woocommerce_variation_option_name'), call_user_func_array, display_price_in_variation_option_name
I changed the following line in your code:
AND products.post_parent = $product->id";
to this
AND products.post_parent = '$product->id' ";
and now, no more errors. The error log stays nice and empty.
Just wanted to share in case anybody else ran into the problem.