Merge pull request #7521 from pjv/fix-BadMethodCallException

fix BadMethodCallException
This commit is contained in:
Mike Jolley 2015-02-23 11:06:00 +00:00
commit 5d715a4c0b
1 changed files with 6 additions and 2 deletions

View File

@ -481,7 +481,9 @@ class WC_Meta_Box_Product_Data {
foreach ( $product_ids as $product_id ) {
$product = wc_get_product( $product_id );
$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
if ( is_object( $product ) ) {
$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
}
}
echo esc_attr( json_encode( $json_ids ) );
@ -494,7 +496,9 @@ class WC_Meta_Box_Product_Data {
foreach ( $product_ids as $product_id ) {
$product = wc_get_product( $product_id );
$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
if ( is_object( $product ) ) {
$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
}
}
echo esc_attr( json_encode( $json_ids ) );