I have to add extra column with checkbox to Wordpress/WooCommerce product listing in admin panel.Its purpose is to quickly update extra meta parameter of the product without entering quick edit.
I added column, but I have a problem with displaying checkbox and placing the column brefore featured star as on attached image. How to update meta with ajax in such case?
Current code:
add_action( 'manage_product_posts_extra_column', 'print_extra_columns', 15, 3 );
add_filter( 'manage_product_posts_columns', 'add_extra_columns', 15 );
function print_extra_columns( $value, $column_name )
{
if( 'extra' == $column_name ) {
$checked = "";
$checkbox =
'<label><input type="checkbox" name="aim" '
. $checked
. ' disabled="disabled" /> Has AIM?</label><br />';
return $checkbox;
}
}
function add_extra_columns( $defaults )
{
$defaults['extra'] = 'Extra';
return $defaults;
}
Aucun commentaire:
Enregistrer un commentaire