Skip to content

Instantly share code, notes, and snippets.

@thijsbouwes
Last active February 8, 2020 10:36
Show Gist options
  • Save thijsbouwes/cd611e04fd8fca1ba5d8817719cc4562 to your computer and use it in GitHub Desktop.
Save thijsbouwes/cd611e04fd8fca1ba5d8817719cc4562 to your computer and use it in GitHub Desktop.
Daiscon pixel bulk edit
<?php
add_action('woocommerce_product_bulk_edit_start', 'daisycon_pixel_cc_field_bulk_edit_input');
function daisycon_pixel_cc_field_bulk_edit_input() {
?>
<div class="inline-edit-group">
<label class="alignleft">
<span class="title">
<?php _e('Daisycon Pixel Commissie Code', 'woocommerce'); ?>
</span>
<span class="input-text-wrap">
<input type="text" name="_daisycon_cc" class="text" value="">
</span>
</label>
</div>
<?php
}
add_action('woocommerce_product_bulk_edit_save', 'daisycon_pixel_cc_field_bulk_edit_save');
function daisycon_pixel_cc_field_bulk_edit_save($product) {
$field = $_REQUEST['_daisycon_cc'];
if ($field) {
update_post_meta($product->get_id(), '_daisycon_cc', wc_clean($field));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment