Categories
WooCommerce

WooCommerce Product Edit Permission

And the Persian Mathematician.

Removal of the option to edit some product fields for specific user role (update the fields and the user role):

if ( ! current_user_can( 'manage_options' ) ) {
	add_action( 'init', 'condless_remove_features' );
	add_action( 'add_meta_boxes_product', 'condless_remove_metaboxes_edit_product', 9999 );
	add_filter( 'woocommerce_product_data_tabs', 'condless_remove_tabs' );
}

function condless_remove_features() {
	remove_post_type_support( 'product', 'editor' );
}

function condless_remove_metaboxes_edit_product() {
	remove_meta_box( 'postexcerpt', 'product', 'normal' );
	remove_meta_box( 'postimagediv', 'product', 'side' );
	remove_meta_box( 'woocommerce-product-images', 'product', 'side' );
}

function condless_remove_tabs( $tabs ) {
	unset( $tabs['advanced'] );
	return( $tabs );
}

As you probably have noticed- the source of the numbering system is India, the West was exposed to the method only in the 11th century, and mainly through the writings of the Persian Mathematician al-Khwarizmi, which the term “algorithm” was named after him.

Leave a Reply

Your email address will not be published. Required fields are marked *