Fix for Undefined index: _regular_price, _sale_price, _tax_status, _tax_class, _visibility, _purchase_note

Undefined index appears for: _regular_price, _sale_price, _tax_status,
_tax_class, _visibility, _purchase_note, when fields are empty, for
example.

Notice: Undefined index: _tax_class in
woocommerce\admin\post-types\writepanels\writepanel-product_data.php on
line 678
This commit is contained in:
Todd Lahman 2013-06-11 15:07:44 -07:00
parent 3d118b37b2
commit e7738184a0
1 changed files with 6 additions and 6 deletions

View File

@ -667,12 +667,12 @@ function woocommerce_process_product_meta( $post_id, $post ) {
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
// Update post meta
update_post_meta( $post_id, '_regular_price', stripslashes( $_POST['_regular_price'] ) );
update_post_meta( $post_id, '_sale_price', stripslashes( $_POST['_sale_price'] ) );
update_post_meta( $post_id, '_tax_status', stripslashes( $_POST['_tax_status'] ) );
update_post_meta( $post_id, '_tax_class', stripslashes( $_POST['_tax_class'] ) );
update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
update_post_meta( $post_id, '_purchase_note', stripslashes( $_POST['_purchase_note'] ) );
if ( isset( $_POST['_regular_price'] ) ) update_post_meta( $post_id, '_regular_price', stripslashes( $_POST['_regular_price'] ) );
if ( isset( $_POST['_sale_price'] ) ) update_post_meta( $post_id, '_sale_price', stripslashes( $_POST['_sale_price'] ) );
if ( isset( $_POST['_tax_status'] ) ) update_post_meta( $post_id, '_tax_status', stripslashes( $_POST['_tax_status'] ) );
if ( isset( $_POST['_tax_class'] ) ) update_post_meta( $post_id, '_tax_class', stripslashes( $_POST['_tax_class'] ) );
if ( isset( $_POST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
if ( isset( $_POST['_purchase_note'] ) ) update_post_meta( $post_id, '_purchase_note', stripslashes( $_POST['_purchase_note'] ) );
update_post_meta( $post_id, '_featured', isset( $_POST['_featured'] ) ? 'yes' : 'no' );
// Dimensions