Error issue

Below code works for me, added below hook into functions.php file


add_filter( 'woocommerce_rest_check_permissions', 'my_woocommerce_rest_check_permissions', 90, 4 );
   function my_woocommerce_rest_check_permissions( $permission, $context, $object_id, $post_type ){
   return true;
}