Merge pull request #15013 from woocommerce/fix/15000

Protect against notices/errors
This commit is contained in:
Claudio Sanches 2017-05-10 18:35:08 -03:00 committed by GitHub
commit fcbff8ef8d
2 changed files with 2 additions and 3 deletions

View File

@ -233,8 +233,7 @@ class WC_Admin_Assets {
$post_id = isset( $post->ID ) ? $post->ID : '';
$currency = '';
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
$order = wc_get_order( $post_id );
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) && ( $order = wc_get_order( $post_id ) ) ) {
$currency = $order->get_currency();
}

View File

@ -73,7 +73,7 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
/**
* If a variation title is not in sync with the parent e.g. saved prior to 3.0, or if the parent title has changed, detect here and update.
*/
if ( version_compare( get_post_meta( $product->get_id(), '_product_version', true ), '3.0', '<' ) && 0 !== strpos( $post_object->post_title, get_post_field( 'post_title', $product->get_parent_id() ) ) ) {
if ( version_compare( get_post_meta( $product->get_id(), '_product_version', true ), '3.0', '<' ) && ( $parent_title = get_post_field( 'post_title', $product->get_parent_id() ) ) && 0 !== strpos( $post_object->post_title, $parent_title ) ) {
global $wpdb;
$new_title = $this->generate_product_title( $product );