Skip to content

Commit

Permalink
fix: undefined index warning is fixed #426 (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Nov 26, 2018
1 parent 7c5bb74 commit a4c98af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions includes/admin-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,23 @@ function dokan_admin_shop_order_edit_columns( $existing_columns ) {
$existing_columns['suborder'] = __( 'Sub Order', 'dokan-lite' );
}

if ( WC_VERSION > '3.2.6' ) {
// Remove seller, suborder column if seller is viewing his own product
if ( ! current_user_can( 'manage_woocommerce' ) || ( isset( $_GET['author'] ) && ! empty( $_GET['author'] ) ) ) {
unset( $columns['suborder'] );
unset( $columns['seller'] );
}

return apply_filters( 'dokan_edit_shop_order_columns', $columns );
}

// Remove seller, suborder column if seller is viewing his own product
if ( ! current_user_can( 'manage_woocommerce' ) || ( isset( $_GET['author'] ) && ! empty( $_GET['author'] ) ) ) {
unset( $columns['suborder'] );
unset( $columns['seller'] );
unset( $existing_columns['suborder'] );
unset( $existing_columns['seller'] );
}

return apply_filters( 'dokan_edit_shop_order_columns', $columns );
return apply_filters( 'dokan_edit_shop_order_columns', $existing_columns );
}

add_filter( 'manage_edit-shop_order_columns', 'dokan_admin_shop_order_edit_columns', 11 );
Expand Down
2 changes: 1 addition & 1 deletion includes/wc-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function dokan_process_product_meta( $post_id ) {
wc_update_product_stock( $post_id, $stock_amount );
}

update_post_meta( $post_id, '_low_stock_amount', wc_stock_amount( $_POST['_low_stock_amount'] ) );
update_post_meta( $post_id, '_low_stock_amount', $_low_stock_amount );
} else {
update_post_meta( $post_id, '_stock', '' );
update_post_meta( $post_id, '_low_stock_amount', '' );
Expand Down

0 comments on commit a4c98af

Please sign in to comment.