wc_products_array_filter_editable()WC 3.0.0

Callback for array filter to get products the user can edit only.

No Hooks.

Return

true|false.

Usage

wc_products_array_filter_editable( $product );
$product(WC_Product) (required)
WC_Product object.

Changelog

Since 3.0.0 Introduced.

wc_products_array_filter_editable() code WC 9.3.1

function wc_products_array_filter_editable( $product ) {
	return $product && is_a( $product, 'WC_Product' ) && current_user_can( 'edit_product', $product->get_id() );
}