Skip to content

Commit

Permalink
Express Checkout - Digital / Virtual Goods - NOSHIPPING Global, ref #175
Browse files Browse the repository at this point in the history
  • Loading branch information
jigneshkailam committed Jun 17, 2015
1 parent 70fd8f2 commit 892c901
Showing 1 changed file with 47 additions and 10 deletions.
57 changes: 47 additions & 10 deletions paypal-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct()
add_action('admin_footer-edit.php', array( $this, 'angelleye_bulk_admin_footer'), 11);
add_action('load-edit.php', array( $this, 'angelleye_bulk_action' ), 11 );
add_action('admin_notices', array( $this, 'angelleye_bulk_admin_notices' ) );
//add_filter( 'bulk_actions-edit-product', array( $this, 'my_custom_bulk_actions' ), 11 );
add_filter( 'bulk_actions-edit-product', array( $this, 'my_custom_bulk_actions' ), 11 );

}

Expand Down Expand Up @@ -621,35 +621,47 @@ public function angelleye_bulk_action() {
case 'enable_shipping_address_for_downloadable_products':
$updated_count = 0;
foreach ($post_ids as $post_id) {
update_post_meta( $post_id, '_no_shipping_required', 'true');
$updated_count++;
$product = get_product( $post_id );
if( $product->is_type( 'downloadable' ) ){
update_post_meta( $post_id, '_no_shipping_required', 'true');
$updated_count++;
}
}
$sendback = add_query_arg(array('enable_shipping_address_for_downloadable_products' => $updated_count, 'ids' => join(',', $post_ids)), 'edit.php?post_type=product');
$sendback = esc_url_raw($sendback);
break;
case 'disable_shipping_address_for_downloadable_products':
$updated_count = 0;
foreach ($post_ids as $post_id) {
update_post_meta( $post_id, '_no_shipping_required', 'false');
$updated_count++;
$product = get_product( $post_id );
if( $product->is_type( 'downloadable' ) ){
update_post_meta( $post_id, '_no_shipping_required', 'false');
$updated_count++;
}
}
$sendback = add_query_arg(array('disable_shipping_address_for_downloadable_products' => $updated_count, 'ids' => join(',', $post_ids)), 'edit.php?post_type=product');
$sendback = esc_url_raw($sendback);
break;
case 'enable_shipping_address_for_virtual_products':
$updated_count = 0;
foreach ($post_ids as $post_id) {
update_post_meta( $post_id, '_no_shipping_required', 'true');
$updated_count++;
$product = get_product( $post_id );
if( $product->is_type( 'virtual' ) ){
update_post_meta( $post_id, '_no_shipping_required', 'true');
$updated_count++;
}
}
$sendback = add_query_arg(array('enable_shipping_address_for_virtual_products' => $updated_count, 'ids' => join(',', $post_ids)), 'edit.php?post_type=product');
$sendback = esc_url_raw($sendback);
break;
case 'disable_shipping_address_for_virtual_products':
$updated_count = 0;
$updated_count = 0;
foreach ($post_ids as $post_id) {
update_post_meta( $post_id, '_no_shipping_required', 'false');
$updated_count++;
$product = get_product( $post_id );
if( $product->is_type( 'virtual' ) ){
update_post_meta( $post_id, '_no_shipping_required', 'false');
$updated_count++;
}
}
$sendback = add_query_arg(array('disable_shipping_address_for_virtual_products' => $updated_count, 'ids' => join(',', $post_ids)), 'edit.php?post_type=product');
$sendback = esc_url_raw($sendback);
Expand All @@ -670,6 +682,31 @@ public function angelleye_bulk_admin_notices() {
$message = sprintf( __( 'Shipping Address enabled for %s products.', $this->plugin_slug ), number_format_i18n( $_REQUEST['enable_shipping_address_for_all_products'] ) );
echo '<div class="updated"><p>'.$message.'</p></div>';
}

if($pagenow == 'edit.php' && $post_type == 'product' && isset($_REQUEST['disable_shipping_address_for_all_products']) && (int) $_REQUEST['disable_shipping_address_for_all_products'] && ($_REQUEST['disable_shipping_address_for_all_products'] > 0)) {
$message = sprintf( __( 'Shipping Address disabled for %s products.', $this->plugin_slug ), number_format_i18n( $_REQUEST['disable_shipping_address_for_all_products'] ) );
echo '<div class="updated"><p>'.$message.'</p></div>';
}

if($pagenow == 'edit.php' && $post_type == 'product' && isset($_REQUEST['enable_shipping_address_for_downloadable_products']) && (int) $_REQUEST['enable_shipping_address_for_downloadable_products'] && ($_REQUEST['enable_shipping_address_for_downloadable_products'] > 0)) {
$message = sprintf( __( 'Shipping Address enabled for %s products.', $this->plugin_slug ), number_format_i18n( $_REQUEST['enable_shipping_address_for_downloadable_products'] ) );
echo '<div class="updated"><p>'.$message.'</p></div>';
}

if($pagenow == 'edit.php' && $post_type == 'product' && isset($_REQUEST['disable_shipping_address_for_downloadable_products']) && (int) $_REQUEST['disable_shipping_address_for_downloadable_products'] && ($_REQUEST['disable_shipping_address_for_downloadable_products'] > 0)) {
$message = sprintf( __( 'Shipping Address disabled for %s products.', $this->plugin_slug ), number_format_i18n( $_REQUEST['disable_shipping_address_for_downloadable_products'] ) );
echo '<div class="updated"><p>'.$message.'</p></div>';
}

if($pagenow == 'edit.php' && $post_type == 'product' && isset($_REQUEST['enable_shipping_address_for_virtual_products']) && (int) $_REQUEST['enable_shipping_address_for_virtual_products'] && ($_REQUEST['enable_shipping_address_for_virtual_products'] > 0)) {
$message = sprintf( __( 'Shipping Address enabled for %s products.', $this->plugin_slug ), number_format_i18n( $_REQUEST['enable_shipping_address_for_virtual_products'] ) );
echo '<div class="updated"><p>'.$message.'</p></div>';
}

if($pagenow == 'edit.php' && $post_type == 'product' && isset($_REQUEST['disable_shipping_address_for_virtual_products']) && (int) $_REQUEST['disable_shipping_address_for_virtual_products'] && ($_REQUEST['disable_shipping_address_for_virtual_products'] > 0)) {
$message = sprintf( __( 'Shipping Address disabled for %s products.', $this->plugin_slug ), number_format_i18n( $_REQUEST['disable_shipping_address_for_virtual_products'] ) );
echo '<div class="updated"><p>'.$message.'</p></div>';
}

}

Expand Down

0 comments on commit 892c901

Please sign in to comment.